forked from floaterxk/DatDefragAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWinMain.cpp
62 lines (43 loc) · 992 Bytes
/
WinMain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "StdAfx.h"
#include "DefragDAT.h"
HINSTANCE g_hInstance;
BOOL g_bQuit = FALSE;
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
INITCOMMONCONTROLSEX iccex;
iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
iccex.dwICC = ICC_INTERNET_CLASSES;
InitCommonControlsEx(&iccex);
g_hInstance = hInstance;
g_hWndMain = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MAIN), NULL, MainProc);
if (!g_hWndMain)
{
MessageBox(NULL, "There was an error creating the main dialog. Exiting..", "Fatal Error", MB_ICONHAND);
return 0;
}
ShowWindow(g_hWndMain, nCmdShow);
MSG msg;
msg.message = WM_NULL;
while (!g_bQuit)
{
if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
{
if (IsDialogMessage(g_hWndMain, &msg))
continue;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
DefragCheckup();
Sleep(1);
}
if (msg.message == WM_QUIT)
g_bQuit = TRUE;
}
DefragCleanup();
return 0;
}