mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[RAPPS] Use different mutex and title for AppWiz mode (#7350)
The two different modes needs separate mutex and window titles, otherwise you can end up stuck in AppWiz mode.
This commit is contained in:
parent
4f4be5c498
commit
2f83e6a65d
2 changed files with 6 additions and 5 deletions
|
@ -749,8 +749,7 @@ CMainWindow::GetWndClassInfo()
|
|||
HWND
|
||||
CMainWindow::Create()
|
||||
{
|
||||
CStringW szWindowName;
|
||||
szWindowName.LoadStringW(IDS_APPTITLE);
|
||||
const CStringW szWindowName(MAKEINTRESOURCEW(m_bAppwizMode ? IDS_APPWIZ_TITLE : IDS_APPTITLE));
|
||||
|
||||
RECT r = {
|
||||
(SettingsInfo.bSaveWndPos ? SettingsInfo.Left : CW_USEDEFAULT),
|
||||
|
|
|
@ -349,16 +349,17 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int nCmdShow)
|
|||
if (argc == 1 || bAppwizMode) // RAPPS is launched without options or APPWIZ mode is requested
|
||||
{
|
||||
// Check whether the RAPPS MainWindow is already launched in another process
|
||||
HANDLE hMutex;
|
||||
CStringW szWindowText(MAKEINTRESOURCEW(bAppwizMode ? IDS_APPWIZ_TITLE : IDS_APPTITLE));
|
||||
LPCWSTR pszMutex = bAppwizMode ? L"RAPPWIZ" : szWindowClass;
|
||||
|
||||
hMutex = CreateMutexW(NULL, FALSE, szWindowClass);
|
||||
HANDLE hMutex = CreateMutexW(NULL, FALSE, pszMutex);
|
||||
if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS))
|
||||
{
|
||||
/* If already started, find its window */
|
||||
HWND hWindow;
|
||||
for (int wait = 2500, inter = 250; wait > 0; wait -= inter)
|
||||
{
|
||||
if ((hWindow = FindWindowW(szWindowClass, NULL)) != NULL)
|
||||
if ((hWindow = FindWindowW(szWindowClass, szWindowText)) != NULL)
|
||||
break;
|
||||
Sleep(inter);
|
||||
}
|
||||
|
@ -376,6 +377,7 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int nCmdShow)
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
szWindowText.Empty();
|
||||
|
||||
CMainWindow wnd(&db, bAppwizMode);
|
||||
MainWindowLoop(&wnd, nCmdShow);
|
||||
|
|
Loading…
Reference in a new issue