From 2c965f67d5c960e0fd19158d3fd406d2a8c1d015 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 28 Apr 2019 06:10:45 +0300 Subject: [PATCH] [RAPPS] move the message proc to gui.cpp --- base/applications/rapps/gui.cpp | 28 +++++++++++++++++++++++ base/applications/rapps/include/dialogs.h | 2 ++ base/applications/rapps/winmain.cpp | 24 +------------------ 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp index 852be19bf18..f5151433bf2 100644 --- a/base/applications/rapps/gui.cpp +++ b/base/applications/rapps/gui.cpp @@ -1829,3 +1829,31 @@ VOID InsertRichEditText(const ATL::CStringW& szText, DWORD flags) { InsertRichEditText(szText.GetString(), flags); } + +VOID ShowMainWindow(INT nShowCmd) +{ + HACCEL KeyBrd; + MSG Msg; + + hMainWnd = CreateMainWindow(); + + if (hMainWnd) + { + /* Maximize it if we must */ + ShowWindow(hMainWnd, ((SettingsInfo.bSaveWndPos && SettingsInfo.Maximized) ? SW_MAXIMIZE : nShowCmd)); + UpdateWindow(hMainWnd); + + /* Load the menu hotkeys */ + KeyBrd = LoadAcceleratorsW(NULL, MAKEINTRESOURCEW(HOTKEYS)); + + /* Message Loop */ + while (GetMessageW(&Msg, NULL, 0, 0)) + { + if (!TranslateAcceleratorW(hMainWnd, KeyBrd, &Msg)) + { + TranslateMessage(&Msg); + DispatchMessageW(&Msg); + } + } + } +} diff --git a/base/applications/rapps/include/dialogs.h b/base/applications/rapps/include/dialogs.h index 69e07640869..f05b223f535 100644 --- a/base/applications/rapps/include/dialogs.h +++ b/base/applications/rapps/include/dialogs.h @@ -38,3 +38,5 @@ VOID CreateSettingsDlg(HWND hwnd); // About dialog (aboutdlg.cpp) VOID ShowAboutDialog(); + +VOID ShowMainWindow(INT nShowCmd); diff --git a/base/applications/rapps/winmain.cpp b/base/applications/rapps/winmain.cpp index 98f44a19e06..5660db81acd 100644 --- a/base/applications/rapps/winmain.cpp +++ b/base/applications/rapps/winmain.cpp @@ -126,8 +126,6 @@ INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi { LPCWSTR szWindowClass = L"ROSAPPMGR"; HANDLE hMutex; - HACCEL KeyBrd; - MSG Msg; BOOL bIsFirstLaunch; InitializeAtlModule(hInstance, TRUE); @@ -165,27 +163,7 @@ INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi if (SettingsInfo.bUpdateAtStart || bIsFirstLaunch) CAvailableApps::ForceUpdateAppsDB(); - hMainWnd = CreateMainWindow(); - - if (hMainWnd) - { - /* Maximize it if we must */ - ShowWindow(hMainWnd, ((SettingsInfo.bSaveWndPos && SettingsInfo.Maximized) ? SW_MAXIMIZE : nShowCmd)); - UpdateWindow(hMainWnd); - - /* Load the menu hotkeys */ - KeyBrd = LoadAcceleratorsW(NULL, MAKEINTRESOURCEW(HOTKEYS)); - - /* Message Loop */ - while (GetMessageW(&Msg, NULL, 0, 0)) - { - if (!TranslateAcceleratorW(hMainWnd, KeyBrd, &Msg)) - { - TranslateMessage(&Msg); - DispatchMessageW(&Msg); - } - } - } + ShowMainWindow(nShowCmd); } if (hMutex) -- 2.17.1