[KMTESTS]
[reactos.git] / rosapps / applications / imagesoft / imagesoft.c
1 #include <precomp.h>
2
3 HINSTANCE hInstance;
4 HANDLE ProcessHeap;
5
6 int WINAPI
7 _tWinMain(HINSTANCE hThisInstance,
8 HINSTANCE hPrevInstance,
9 LPTSTR lpCmdLine,
10 int nCmdShow)
11 {
12 LPTSTR lpAppName, lpVersion, lpTitle;
13 HWND hMainWnd;
14 MSG Msg;
15 BOOL bRet;
16 int Ret = 1;
17 size_t len;
18 INITCOMMONCONTROLSEX icex;
19
20 hInstance = hThisInstance;
21 ProcessHeap = GetProcessHeap();
22
23 icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
24 icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES;
25 InitCommonControlsEx(&icex);
26
27 if ( !AllocAndLoadString(&lpAppName, hInstance, IDS_APPNAME) ||
28 !AllocAndLoadString(&lpVersion, hInstance, IDS_VERSION) )
29 {
30 return Ret;
31 }
32
33 len = _tcslen(lpAppName) + _tcslen(lpVersion);
34 lpTitle = HeapAlloc(ProcessHeap,
35 0,
36 (len + 2) * sizeof(TCHAR));
37 if (lpTitle == NULL)
38 {
39 LocalFree((HLOCAL)lpAppName);
40 LocalFree((HLOCAL)lpVersion);
41 return Ret;
42 }
43
44 wsprintf(lpTitle,
45 _T("%s %s"),
46 lpAppName,
47 lpVersion);
48
49 LocalFree((HLOCAL)lpAppName);
50 LocalFree((HLOCAL)lpVersion);
51
52 if (TbdInitImpl())
53 {
54 if (InitMainWindowImpl())
55 {
56 if (InitImageEditWindowImpl())
57 {
58 if (InitFloatWndClass())
59 {
60 hMainWnd = CreateMainWindow(lpTitle,
61 nCmdShow);
62 if (hMainWnd != NULL)
63 {
64 /* pump the message queue */
65 while ((bRet = GetMessage(&Msg,
66 NULL,
67 0,
68 0) != 0))
69 {
70 if (bRet != (BOOL)-1)
71 {
72 if (!MainWndTranslateMDISysAccel(hMainWnd,
73 &Msg))
74 {
75 TranslateMessage(&Msg);
76 DispatchMessage(&Msg);
77 }
78 }
79 }
80
81 Ret = 0;
82 }
83
84 UninitImageEditWindowImpl();
85 }
86
87 UninitFloatWndImpl();
88 }
89
90 UninitMainWindowImpl();
91 }
92
93 TbdUninitImpl();
94 }
95
96 HeapFree(GetProcessHeap(),
97 0,
98 lpTitle);
99
100 return Ret;
101 }