1 /*****************************************************************************
2 
3   Fraginator
4 
5 *****************************************************************************/
6 
7 #define NDEBUG
8 
9 #include "Fraginator.h"
10 #include "Mutex.h"
11 #include "DriveVolume.h"
12 #include "Defragment.h"
13 #include "MainDialog.h"
14 #include "resource.h"
15 #ifdef _MSC_VER
16 #include <crtdbg.h>
17 #endif
18 
19 HINSTANCE   GlobalHInstance = NULL;
20 Defragment *Defrag = NULL;
21 
22 INT WINAPI
23 wWinMain(HINSTANCE HInstance,
24          HINSTANCE hPrev,
25          LPWSTR Cmd,
26          int iCmd)
27 {
28     INITCOMMONCONTROLSEX InitControls;
29 
30     // debugging crap
31 #ifndef NDEBUG
32     _CrtSetDbgFlag (_CRTDBG_LEAK_CHECK_DF | _CrtSetDbgFlag (_CRTDBG_REPORT_FLAG));
33     _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE);
34     _CrtSetReportFile (_CRT_WARN, _CRTDBG_FILE_STDOUT);
35     _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE);
36     _CrtSetReportFile (_CRT_ERROR, _CRTDBG_FILE_STDOUT);
37     _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE);
38     _CrtSetReportFile (_CRT_ASSERT, _CRTDBG_FILE_STDOUT);
39 #endif
40 
41     GlobalHInstance = HInstance;
42 
43     // We want our progress bar! NOW!
44     InitControls.dwSize = sizeof (InitControls);
45     InitControls.dwICC = ICC_WIN95_CLASSES;
46     InitCommonControlsEx (&InitControls);
47 
48     if (!CheckWinVer())
49     {
50         MessageBox (GetDesktopWindow(), L"Sorry, this program requires Windows 2000.", L"Error", MB_OK);
51         return (0);
52     }
53 
54     DialogBox (HInstance, MAKEINTRESOURCE (IDD_MAIN), GetDesktopWindow(), MainDialogProc);
55 
56 #if 0
57     AllocConsole ();
58     if (_CrtDumpMemoryLeaks ())
59         MessageBox (NULL, L"Click OK to quit", L"Leaks", MB_OK);
60 #endif
61 
62     return (0);
63 }
64 
65