浏览代码

With INI file provided on command-line, using the same INI file when starting a new instance

Source commit: e81bf855631a8a489a068089fdc1453189a2d9fb
Martin Prikryl 4 周之前
父节点
当前提交
3b7aa55189
共有 2 个文件被更改,包括 13 次插入6 次删除
  1. 12 6
      source/windows/Tools.cpp
  2. 1 0
      source/windows/Tools.h

+ 12 - 6
source/windows/Tools.cpp

@@ -521,6 +521,7 @@ void __fastcall ExecuteNewInstance(const UnicodeString & Param, const UnicodeStr
     Arg = FORMAT(L"\"%s\"", (Param));
   }
   UnicodeString Space(L" ");
+  AddToList(Arg, GetIniFileParam(), Space);
   AddToList(Arg, TProgramParams::FormatSwitch(NEWINSTANCE_SWICH), Space);
   AddToList(Arg, AdditionalParams, Space);
 
@@ -619,18 +620,23 @@ IShellLink * __fastcall CreateDesktopShortCut(const UnicodeString & Name,
   return pLink;
 }
 //---------------------------------------------------------------------------
-IShellLink * __fastcall CreateAppDesktopShortCut(
-  const UnicodeString & Name, const UnicodeString & AParams, const UnicodeString & Description,
-  int SpecialFolder, int IconIndex, bool Return)
+UnicodeString GetIniFileParam()
 {
   UnicodeString ParamValue = Configuration->GetIniFileParamValue();
 
-  UnicodeString Params;
+  UnicodeString Result;
   if (!ParamValue.IsEmpty())
   {
-    Params = TProgramParams::FormatSwitch(INI_SWITCH) + L"=" + AddQuotes(ParamValue);
+    Result = TProgramParams::FormatSwitch(INI_SWITCH) + L"=" + AddQuotes(ParamValue);
   }
-
+  return Result;
+}
+//---------------------------------------------------------------------------
+IShellLink * __fastcall CreateAppDesktopShortCut(
+  const UnicodeString & Name, const UnicodeString & AParams, const UnicodeString & Description,
+  int SpecialFolder, int IconIndex, bool Return)
+{
+  UnicodeString Params = GetIniFileParam();
   AddToList(Params, AParams, L" ");
 
   return CreateDesktopShortCut(Name, Application->ExeName, Params, Description, SpecialFolder, IconIndex, Return);

+ 1 - 0
source/windows/Tools.h

@@ -20,6 +20,7 @@ bool __fastcall UseAlternativeFunction();
 bool __fastcall OpenInNewWindow();
 void ExecuteSelf(const UnicodeString & Params);
 void __fastcall ExecuteNewInstance(const UnicodeString & Param, const UnicodeString & AdditionalParams = UnicodeString());
+UnicodeString GetIniFileParam();
 IShellLink * __fastcall CreateAppDesktopShortCut(
   const UnicodeString & Name, const UnicodeString & Params, const UnicodeString & Description,
   int SpecialFolder = -1, int IconIndex = 0, bool Return = false);