https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d6fecc52d13ed96020a64…
commit d6fecc52d13ed96020a64946499de60fb88a2abf
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Tue May 23 23:50:04 2023 +0300
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Sat May 27 15:31:03 2023 +0300
[RAPPS] Move CMainWindow creation to upper function
---
base/applications/rapps/gui.cpp | 8 +-------
base/applications/rapps/include/dialogs.h | 4 ----
base/applications/rapps/include/gui.h | 4 ++++
base/applications/rapps/unattended.cpp | 5 +++--
4 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp
index 353dd3bcbce..2d5eb7e098a 100644
--- a/base/applications/rapps/gui.cpp
+++ b/base/applications/rapps/gui.cpp
@@ -781,15 +781,11 @@ CMainWindow::HandleTabOrder(int direction)
// **** CMainWindow ****
VOID
-MainWindowLoop(CAppDB *db, INT nShowCmd)
+MainWindowLoop(CMainWindow *wnd, INT nShowCmd)
{
HACCEL KeyBrd;
MSG Msg;
- CMainWindow *wnd = new CMainWindow(db);
- if (!wnd)
- return;
-
hMainWnd = wnd->Create();
if (!hMainWnd)
return;
@@ -819,6 +815,4 @@ MainWindowLoop(CAppDB *db, INT nShowCmd)
DispatchMessageW(&Msg);
}
}
-
- delete wnd;
}
diff --git a/base/applications/rapps/include/dialogs.h
b/base/applications/rapps/include/dialogs.h
index ba94025b4a3..93b8720f497 100644
--- a/base/applications/rapps/include/dialogs.h
+++ b/base/applications/rapps/include/dialogs.h
@@ -8,10 +8,6 @@
VOID
CreateSettingsDlg(HWND hwnd);
-// Main window
-VOID
-MainWindowLoop(class CAppDB *db, INT nShowCmd);
-
// Download dialogs
VOID
DownloadApplicationsDB(LPCWSTR lpUrl, BOOL IsOfficial);
diff --git a/base/applications/rapps/include/gui.h
b/base/applications/rapps/include/gui.h
index 4cbd6d267fd..ee136f48133 100644
--- a/base/applications/rapps/include/gui.h
+++ b/base/applications/rapps/include/gui.h
@@ -131,3 +131,7 @@ class CMainWindow : public CWindowImpl<CMainWindow, CWindow,
CFrameWinTraits>
void
HandleTabOrder(int direction);
};
+
+// Main window
+VOID
+MainWindowLoop(CMainWindow *wnd, INT nShowCmd);
diff --git a/base/applications/rapps/unattended.cpp
b/base/applications/rapps/unattended.cpp
index 94fecfbeea7..9a5fa2a3fa5 100644
--- a/base/applications/rapps/unattended.cpp
+++ b/base/applications/rapps/unattended.cpp
@@ -6,7 +6,7 @@
* Copyright 2020 He Yang (1160386205(a)qq.com)
*/
-#include "rapps.h"
+#include "gui.h"
#include "unattended.h"
#include <setupapi.h>
#include <conutils.h>
@@ -256,7 +256,8 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int
nCmdShow)
return FALSE;
}
- MainWindowLoop(&db, nCmdShow);
+ CMainWindow wnd(&db);
+ MainWindowLoop(&wnd, nCmdShow);
if (hMutex)
CloseHandle(hMutex);