mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +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
|
HWND
|
||||||
CMainWindow::Create()
|
CMainWindow::Create()
|
||||||
{
|
{
|
||||||
CStringW szWindowName;
|
const CStringW szWindowName(MAKEINTRESOURCEW(m_bAppwizMode ? IDS_APPWIZ_TITLE : IDS_APPTITLE));
|
||||||
szWindowName.LoadStringW(IDS_APPTITLE);
|
|
||||||
|
|
||||||
RECT r = {
|
RECT r = {
|
||||||
(SettingsInfo.bSaveWndPos ? SettingsInfo.Left : CW_USEDEFAULT),
|
(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
|
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
|
// 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 ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS))
|
||||||
{
|
{
|
||||||
/* If already started, find its window */
|
/* If already started, find its window */
|
||||||
HWND hWindow;
|
HWND hWindow;
|
||||||
for (int wait = 2500, inter = 250; wait > 0; wait -= inter)
|
for (int wait = 2500, inter = 250; wait > 0; wait -= inter)
|
||||||
{
|
{
|
||||||
if ((hWindow = FindWindowW(szWindowClass, NULL)) != NULL)
|
if ((hWindow = FindWindowW(szWindowClass, szWindowText)) != NULL)
|
||||||
break;
|
break;
|
||||||
Sleep(inter);
|
Sleep(inter);
|
||||||
}
|
}
|
||||||
|
@ -376,6 +377,7 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int nCmdShow)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
szWindowText.Empty();
|
||||||
|
|
||||||
CMainWindow wnd(&db, bAppwizMode);
|
CMainWindow wnd(&db, bAppwizMode);
|
||||||
MainWindowLoop(&wnd, nCmdShow);
|
MainWindowLoop(&wnd, nCmdShow);
|
||||||
|
|
Loading…
Reference in a new issue