xref: /reactos/base/applications/utilman/utilman.c (revision 3adf4508)
1 /*
2  * PROJECT:         ReactOS Utility Manager (Accessibility)
3  * LICENSE:         GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:         Main dialog code file
5  * COPYRIGHT:       Copyright 2019-2020 George Bișoc (george.bisoc@reactos.org)
6  */
7 
8 /* INCLUDES *******************************************************************/
9 
10 #include "precomp.h"
11 
12 /* FUNCTIONS ******************************************************************/
13 
14 /**
15  * @wWinMain
16  *
17  * Application entry point.
18  *
19  * @param[in]   hInstance
20  *     Application instance.
21  *
22  * @param[in]   hPrevInstance
23  *     The previous instance of the application (not used).
24  *
25  * @param[in]   pCmdLine
26  *     Pointer to a command line argument (in wide string -- not used).
27  *
28  * @param[in]   nCmdShow
29  *     An integer served as a flag to note how the application will be shown (not used).
30  *
31  * @return
32  *     Returns 0 to let the function terminating before it enters in the message loop.
33  *
34  */
35 INT WINAPI wWinMain(IN HINSTANCE hInstance,
36                     IN HINSTANCE hPrevInstance,
37                     IN LPWSTR pCmdLine,
38                     IN INT nCmdShow)
39 {
40     HMODULE hModule;
41     WCHAR szFormat[MAX_BUFFER];
42     WCHAR szFailLoad[MAX_BUFFER];
43     WCHAR szTitle[MAX_BUFFER];
44     EXECDLGROUTINE UManStartDlg;
45 
46     UNREFERENCED_PARAMETER(hPrevInstance);
47     UNREFERENCED_PARAMETER(pCmdLine);
48     UNREFERENCED_PARAMETER(nCmdShow);
49 
50     /* Load the main resources module of Utility Manager */
51     hModule = LoadLibraryW(L"UManDlg.dll");
52     if (!hModule)
53     {
54         LoadStringW(hInstance, IDS_FAIL_INIT, szFormat, _countof(szFormat));
55         LoadStringW(hInstance, IDS_FAIL_INIT_TITLE, szTitle, _countof(szTitle));
56 
57         StringCchPrintfW(szFailLoad, _countof(szFailLoad), szFormat, GetLastError());
58         MessageBoxW(GetDesktopWindow(), szFailLoad, szTitle, MB_ICONERROR | MB_OK);
59         return -1;
60     }
61 
62     /* Get the function address and launch Utility Manager */
63     UManStartDlg = (EXECDLGROUTINE)GetProcAddress(hModule, "UManStartDlg");
64     UManStartDlg();
65 
66     FreeLibrary(hModule);
67     return 0;
68 }
69