mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-10-31 09:22:15 +08:00 
			
		
		
		
	Fix for slow startup under certain conditions (#1122)
Fixes #1122 by simply calling CreateProcess before the SendMessageTimeout calls that are used to propagate environment variable changes.
This commit is contained in:
		| @@ -169,8 +169,7 @@ void StartCmder(std::wstring path, bool is_single_mode) | ||||
| 		} | ||||
| 	} | ||||
| 	// Ensure EnvironmentVariables are propagated. | ||||
| 	SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Environment", SMTO_ABORTIFHUNG, 5000, NULL); | ||||
| 	SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) L"Environment", SMTO_ABORTIFHUNG, 5000, NULL); // For Windows >= 8 | ||||
|  | ||||
|  | ||||
| 	STARTUPINFO si = { 0 }; | ||||
| 	si.cb = sizeof(STARTUPINFO); | ||||
| @@ -178,12 +177,15 @@ void StartCmder(std::wstring path, bool is_single_mode) | ||||
| 	si.lpTitle = appId; | ||||
| 	si.dwFlags = STARTF_TITLEISAPPID; | ||||
| #endif | ||||
|  | ||||
| 	PROCESS_INFORMATION pi; | ||||
| 	if (!CreateProcess(conEmuPath, args, NULL, NULL, false, 0, NULL, NULL, &si, &pi)) { | ||||
| 		MessageBox(NULL, _T("Unable to create the ConEmu Process!"), _T("Error"), MB_OK); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	LRESULT lr = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM)"Environment", SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG, 5000, NULL); | ||||
| 	lr = SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) L"Environment", SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG, 5000, NULL); // For Windows >= 8 | ||||
|  | ||||
| } | ||||
|  | ||||
| bool IsUserOnly(std::wstring opt) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user