Create a branch for header work.
[reactos.git] / base / applications / mscutils / devmgmt / devmgmt.c
1 /*
2 * PROJECT: ReactOS Device Managment
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/system/devmgmt/devmgmt.c
5 * PURPOSE: Program HQ
6 * COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
7 *
8 */
9
10 #include "precomp.h"
11
12 HINSTANCE hInstance;
13 HANDLE ProcessHeap;
14 HANDLE hMutex;
15
16 int WINAPI
17 _tWinMain(HINSTANCE hThisInstance,
18 HINSTANCE hPrevInstance,
19 LPTSTR lpCmdLine,
20 int nCmdShow)
21 {
22 LPTSTR lpAppName;
23 HWND hMainWnd;
24 MSG Msg;
25 int Ret = 1;
26 INITCOMMONCONTROLSEX icex;
27
28 hMutex = CreateMutex(NULL, TRUE, _T("devmgmt_mutex"));
29 if (hMutex == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
30 {
31 if (hMutex)
32 {
33 CloseHandle(hMutex);
34 }
35 return 0;
36 }
37
38 hInstance = hThisInstance;
39 ProcessHeap = GetProcessHeap();
40
41 icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
42 icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES;
43 InitCommonControlsEx(&icex);
44
45 if (!AllocAndLoadString(&lpAppName,
46 hInstance,
47 IDS_APPNAME))
48 {
49 return 1;
50 }
51
52 if (InitMainWindowImpl())
53 {
54 hMainWnd = CreateMainWindow(lpAppName,
55 nCmdShow);
56 if (hMainWnd != NULL)
57 {
58 /* pump the message queue */
59 while( GetMessage( &Msg, NULL, 0, 0 ) )
60 {
61 TranslateMessage(&Msg);
62 DispatchMessage(&Msg);
63
64 }
65
66 Ret = 0;
67 }
68
69 UninitMainWindowImpl();
70 }
71
72 LocalFree((HLOCAL)lpAppName);
73 CloseHandle(hMutex);
74 return Ret;
75 }
76
77
78