[INTL]
[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 #include <winnls.h>
13
14 HINSTANCE hInstance;
15 HANDLE ProcessHeap;
16 HANDLE hMutex;
17
18 int WINAPI
19 _tWinMain(HINSTANCE hThisInstance,
20 HINSTANCE hPrevInstance,
21 LPTSTR lpCmdLine,
22 int nCmdShow)
23 {
24 LPTSTR lpAppName;
25 HWND hMainWnd;
26 MSG Msg;
27 int Ret = 1;
28 INITCOMMONCONTROLSEX icex;
29
30 hMutex = CreateMutex(NULL, TRUE, _T("devmgmt_mutex"));
31 if (hMutex == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
32 {
33 if (hMutex)
34 {
35 CloseHandle(hMutex);
36 }
37 return 0;
38 }
39
40 switch (GetUserDefaultUILanguage())
41 {
42 case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT):
43 SetProcessDefaultLayout(LAYOUT_RTL);
44 break;
45
46 default:
47 break;
48 }
49
50 hInstance = hThisInstance;
51 ProcessHeap = GetProcessHeap();
52
53 icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
54 icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES;
55 InitCommonControlsEx(&icex);
56
57 if (!AllocAndLoadString(&lpAppName,
58 hInstance,
59 IDS_APPNAME))
60 {
61 return 1;
62 }
63
64 if (InitMainWindowImpl())
65 {
66 hMainWnd = CreateMainWindow(lpAppName,
67 nCmdShow);
68 if (hMainWnd != NULL)
69 {
70 /* pump the message queue */
71 while( GetMessage( &Msg, NULL, 0, 0 ) )
72 {
73 TranslateMessage(&Msg);
74 DispatchMessage(&Msg);
75
76 }
77
78 Ret = 0;
79 }
80
81 UninitMainWindowImpl();
82 }
83
84 LocalFree((HLOCAL)lpAppName);
85 CloseHandle(hMutex);
86 return Ret;
87 }
88
89
90