ReactOS
0.4.16-dev-725-g22577ae
winmain.cpp
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS Applications Manager
3
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4
* PURPOSE: Main program
5
* COPYRIGHT: Copyright 2009 Dmitry Chapyshev (dmitry@reactos.org)
6
* Copyright 2015 Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com)
7
* Copyright 2017 Alexander Shaposhnikov (sanchaez@reactos.org)
8
*/
9
#include "
rapps.h
"
10
#include "
unattended.h
"
11
#include "
winmain.h
"
12
#include <atlcom.h>
13
#include <
gdiplus.h
>
14
#include <
conutils.h
>
15
16
LPCWSTR
szWindowClass
=
MAINWINDOWCLASSNAME
;
17
LONG
g_Busy
= 0;
18
19
HWND
hMainWnd
;
20
HINSTANCE
hInst
;
21
SETTINGS_INFO
SettingsInfo
;
22
23
BEGIN_OBJECT_MAP
(ObjectMap)
24
END_OBJECT_MAP
()
25
26
CComModule
gModule
;
27
CAtlWinModule
gWinModule
;
28
29
INT
WINAPI
30
wWinMain
(
HINSTANCE
hInstance
,
HINSTANCE
hPrevInstance,
LPWSTR
lpCmdLine,
INT
nShowCmd)
31
{
32
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
33
ULONG_PTR
gdiplusToken;
34
35
gModule
.
Init
(ObjectMap,
hInstance
,
NULL
);
36
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput,
NULL
);
37
38
if
(
GetUserDefaultUILanguage
() ==
MAKELANGID
(
LANG_HEBREW
,
SUBLANG_DEFAULT
))
39
{
40
SetProcessDefaultLayout
(
LAYOUT_RTL
);
41
}
42
43
hInst
=
hInstance
;
44
BOOL
bIsFirstLaunch = !
LoadSettings
(&
SettingsInfo
);
45
46
InitLogs
();
47
InitCommonControls
();
48
SetThreadPriority
(
GetCurrentThread
(),
THREAD_PRIORITY_ABOVE_NORMAL
);
// Give UI higher priority than background threads
49
50
// parse cmd-line and perform the corresponding operation
51
BOOL
bSuccess
=
ParseCmdAndExecute
(
GetCommandLineW
(), bIsFirstLaunch,
SW_SHOWNORMAL
);
52
53
Gdiplus::GdiplusShutdown(gdiplusToken);
54
gModule
.
Term
();
55
56
return
bSuccess
? 0 : 1;
57
}
LoadSettings
void LoadSettings(void)
Definition:
settings.c:53
InitLogs
VOID InitLogs()
Definition:
misc.cpp:205
hInstance
HINSTANCE hInstance
Definition:
charmap.c:19
ATL::CAtlWinModule
Definition:
atlbase.h:1055
ATL::CComModule
Definition:
atlbase.h:870
ATL::CComModule::Term
void Term()
Definition:
atlbase.h:916
ATL::CComModule::Init
HRESULT Init(_ATL_OBJMAP_ENTRY *p, HINSTANCE, const GUID *plibid)
Definition:
atlbase.h:886
InitCommonControls
VOID WINAPI InitCommonControls(void)
Definition:
commctrl.c:870
conutils.h
NULL
#define NULL
Definition:
types.h:112
GetCommandLineW
LPWSTR WINAPI GetCommandLineW(VOID)
Definition:
proc.c:2019
SetThreadPriority
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
Definition:
thread.c:700
GetUserDefaultUILanguage
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition:
locale.c:1375
bSuccess
static BOOLEAN bSuccess
Definition:
drive.cpp:355
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
gdiplus.h
void
Definition:
nsiface.idl:2307
END_OBJECT_MAP
#define END_OBJECT_MAP()
Definition:
atlcom.h:691
BEGIN_OBJECT_MAP
#define BEGIN_OBJECT_MAP(x)
Definition:
atlcom.h:689
LONG
long LONG
Definition:
pedump.c:60
rapps.h
MAINWINDOWCLASSNAME
#define MAINWINDOWCLASSNAME
Definition:
rapps.h:20
MAKELANGID
#define MAKELANGID(p, s)
Definition:
nls.h:15
LANG_HEBREW
#define LANG_HEBREW
Definition:
nls.h:67
SUBLANG_DEFAULT
#define SUBLANG_DEFAULT
Definition:
nls.h:168
SETTINGS_INFO
Definition:
settings.h:6
INT
int32_t INT
Definition:
typedefs.h:58
ULONG_PTR
uint32_t ULONG_PTR
Definition:
typedefs.h:65
unattended.h
ParseCmdAndExecute
BOOL ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int nCmdShow)
Definition:
unattended.cpp:327
SetProcessDefaultLayout
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition:
window.c:1701
GetCurrentThread
HANDLE WINAPI GetCurrentThread(void)
Definition:
proc.c:1148
THREAD_PRIORITY_ABOVE_NORMAL
#define THREAD_PRIORITY_ABOVE_NORMAL
Definition:
winbase.h:301
WINAPI
#define WINAPI
Definition:
msvc.h:6
LAYOUT_RTL
#define LAYOUT_RTL
Definition:
wingdi.h:1371
gWinModule
CAtlWinModule gWinModule
Definition:
winmain.cpp:27
hInst
HINSTANCE hInst
Definition:
winmain.cpp:20
hMainWnd
HWND hMainWnd
Definition:
winmain.cpp:19
wWinMain
INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nShowCmd)
Definition:
winmain.cpp:30
gModule
CComModule gModule
Definition:
winmain.cpp:26
szWindowClass
LPCWSTR szWindowClass
Definition:
winmain.cpp:16
SettingsInfo
SETTINGS_INFO SettingsInfo
Definition:
winmain.cpp:21
g_Busy
LONG g_Busy
Definition:
winmain.cpp:17
winmain.h
SW_SHOWNORMAL
#define SW_SHOWNORMAL
Definition:
winuser.h:773
LPWSTR
WCHAR * LPWSTR
Definition:
xmlstorage.h:184
LPCWSTR
const WCHAR * LPCWSTR
Definition:
xmlstorage.h:185
base
applications
rapps
winmain.cpp
Generated on Fri Feb 7 2025 06:02:28 for ReactOS by
1.9.6