2 * PROJECT: ReactOS Services
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/applications/mscutils/servman/mainwnd.c
5 * PURPOSE: Main window message handler
6 * COPYRIGHT: Copyright 2006-20015 Ged Murphy <gedmurphy@reactos.org>
14 static const WCHAR szMainWndClass
[] = L
"ServManWndClass";
17 static const TBBUTTON Buttons
[] =
18 { /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
19 {TBICON_PROP
, ID_PROP
, TBSTATE_INDETERMINATE
, BTNS_BUTTON
, {0}, 0, 0}, /* properties */
20 {TBICON_REFRESH
, ID_REFRESH
, TBSTATE_ENABLED
, BTNS_BUTTON
, {0}, 0, 0}, /* refresh */
21 {TBICON_EXPORT
, ID_EXPORT
, TBSTATE_ENABLED
, BTNS_BUTTON
, {0}, 0, 0}, /* export */
23 /* Note: First item for a separator is its width in pixels */
24 {15, 0, TBSTATE_ENABLED
, BTNS_SEP
, {0}, 0, 0}, /* separator */
26 {TBICON_CREATE
, ID_CREATE
, TBSTATE_INDETERMINATE
, BTNS_BUTTON
, {0}, 0, 0 }, /* create */
27 {TBICON_DELETE
, ID_DELETE
, TBSTATE_INDETERMINATE
, BTNS_BUTTON
, {0}, 0, 0 }, /* delete */
29 {15, 0, TBSTATE_ENABLED
, BTNS_SEP
, {0}, 0, 0}, /* separator */
31 {TBICON_START
, ID_START
, TBSTATE_INDETERMINATE
, BTNS_BUTTON
, {0}, 0, 0 }, /* start */
32 {TBICON_STOP
, ID_STOP
, TBSTATE_INDETERMINATE
, BTNS_BUTTON
, {0}, 0, 0 }, /* stop */
33 {TBICON_PAUSE
, ID_PAUSE
, TBSTATE_INDETERMINATE
, BTNS_BUTTON
, {0}, 0, 0 }, /* pause */
34 {TBICON_RESTART
, ID_RESTART
, TBSTATE_INDETERMINATE
, BTNS_BUTTON
, {0}, 0, 0 }, /* restart */
39 static const MENU_HINT MainMenuHintTable
[] = {
41 {ID_EXPORT
, IDS_HINT_EXPORT
},
42 {ID_EXIT
, IDS_HINT_EXIT
},
45 {ID_CONNECT
, IDS_HINT_CONNECT
},
46 {ID_START
, IDS_HINT_START
},
47 {ID_STOP
, IDS_HINT_STOP
},
48 {ID_PAUSE
, IDS_HINT_PAUSE
},
49 {ID_RESUME
, IDS_HINT_RESUME
},
50 {ID_RESTART
, IDS_HINT_RESTART
},
51 {ID_REFRESH
, IDS_HINT_REFRESH
},
52 {ID_EDIT
, IDS_HINT_EDIT
},
53 {ID_CREATE
, IDS_HINT_CREATE
},
54 {ID_DELETE
, IDS_HINT_DELETE
},
55 {ID_PROP
, IDS_HINT_PROP
},
58 {ID_VIEW_LARGE
, IDS_HINT_LARGE
},
59 {ID_VIEW_SMALL
, IDS_HINT_SMALL
},
60 {ID_VIEW_LIST
, IDS_HINT_LIST
},
61 {ID_VIEW_DETAILS
, IDS_HINT_DETAILS
},
62 {ID_VIEW_CUST
, IDS_HINT_CUST
},
65 {ID_HELP
, IDS_HINT_HELP
},
66 {ID_ABOUT
, IDS_HINT_ABOUT
}
68 /* system menu hints */
69 static const MENU_HINT SystemMenuHintTable
[] = {
70 {SC_RESTORE
, IDS_HINT_SYS_RESTORE
},
71 {SC_MOVE
, IDS_HINT_SYS_MOVE
},
72 {SC_SIZE
, IDS_HINT_SYS_SIZE
},
73 {SC_MINIMIZE
, IDS_HINT_SYS_MINIMIZE
},
74 {SC_MAXIMIZE
, IDS_HINT_SYS_MAXIMIZE
},
75 {SC_CLOSE
, IDS_HINT_SYS_CLOSE
},
80 MainWndMenuHint(PMAIN_WND_INFO Info
,
82 const MENU_HINT
*HintArray
,
87 const MENU_HINT
*LastHint
;
88 UINT HintId
= DefHintId
;
90 LastHint
= HintArray
+ HintsCount
;
91 while (HintArray
!= LastHint
)
93 if (HintArray
->CmdId
== CmdId
)
95 HintId
= HintArray
->HintId
;
102 StatusBarLoadString(Info
->hStatus
,
112 UpdateMainStatusBar(PMAIN_WND_INFO Info
)
114 if (Info
->hStatus
!= NULL
)
116 SendMessage(Info
->hStatus
,
118 (WPARAM
)Info
->bInMenuLoop
,
124 UpdateServiceCount(PMAIN_WND_INFO Info
)
126 LPWSTR lpNumServices
;
128 if (AllocAndLoadString(&lpNumServices
,
132 WCHAR szNumServices
[32];
134 INT NumListedServ
= ListView_GetItemCount(Info
->hListView
);
136 _snwprintf(szNumServices
,
141 SendMessage(Info
->hStatus
,
144 (LPARAM
)szNumServices
);
146 LocalFree(lpNumServices
);
151 VOID
SetMenuAndButtonStates(PMAIN_WND_INFO Info
)
156 /* get handle to menu */
157 hMainMenu
= GetMenu(Info
->hMainWnd
);
159 /* set all to greyed */
160 for (i
= ID_START
; i
<= ID_RESTART
; i
++)
162 EnableMenuItem(hMainMenu
, i
, MF_GRAYED
);
163 EnableMenuItem(GetSubMenu(Info
->hShortcutMenu
, 0), i
, MF_GRAYED
);
164 SendMessage(Info
->hTool
, TB_SETSTATE
, i
,
165 (LPARAM
)MAKELONG(TBSTATE_INDETERMINATE
, 0));
168 if (Info
->SelectedItem
!= NO_ITEM_SELECTED
)
170 LPQUERY_SERVICE_CONFIG lpServiceConfig
= NULL
;
173 /* allow user to delete service */
174 if (Info
->bIsUserAnAdmin
)
176 SendMessage(Info
->hTool
, TB_SETSTATE
, ID_DELETE
,
177 (LPARAM
)MAKELONG(TBSTATE_ENABLED
, 0));
178 EnableMenuItem(hMainMenu
, ID_DELETE
, MF_ENABLED
);
179 EnableMenuItem(GetSubMenu(Info
->hShortcutMenu
, 0), ID_DELETE
, MF_ENABLED
);
182 Flags
= Info
->pCurrentService
->ServiceStatusProcess
.dwControlsAccepted
;
183 State
= Info
->pCurrentService
->ServiceStatusProcess
.dwCurrentState
;
185 lpServiceConfig
= GetServiceConfig(Info
->pCurrentService
->lpServiceName
);
187 if (lpServiceConfig
&& lpServiceConfig
->dwStartType
!= SERVICE_DISABLED
)
189 if (State
== SERVICE_STOPPED
)
191 EnableMenuItem(hMainMenu
, ID_START
, MF_ENABLED
);
192 EnableMenuItem(GetSubMenu(Info
->hShortcutMenu
, 0), ID_START
, MF_ENABLED
);
193 SendMessage(Info
->hTool
, TB_SETSTATE
, ID_START
,
194 (LPARAM
)MAKELONG(TBSTATE_ENABLED
, 0));
197 if ( (Flags
& SERVICE_ACCEPT_STOP
) && (State
== SERVICE_RUNNING
) )
199 EnableMenuItem(hMainMenu
, ID_RESTART
, MF_ENABLED
);
200 EnableMenuItem(GetSubMenu(Info
->hShortcutMenu
, 0), ID_RESTART
, MF_ENABLED
);
201 SendMessage(Info
->hTool
, TB_SETSTATE
, ID_RESTART
,
202 (LPARAM
)MAKELONG(TBSTATE_ENABLED
, 0));
207 HeapFree(GetProcessHeap(), 0, lpServiceConfig
);
209 if ( (Flags
& SERVICE_ACCEPT_STOP
) && (State
== SERVICE_RUNNING
) )
211 EnableMenuItem(hMainMenu
, ID_STOP
, MF_ENABLED
);
212 EnableMenuItem(GetSubMenu(Info
->hShortcutMenu
, 0), ID_STOP
, MF_ENABLED
);
213 SendMessage(Info
->hTool
, TB_SETSTATE
, ID_STOP
,
214 (LPARAM
)MAKELONG(TBSTATE_ENABLED
, 0));
217 if ( (Flags
& SERVICE_ACCEPT_PAUSE_CONTINUE
) && (State
== SERVICE_RUNNING
) )
219 EnableMenuItem(hMainMenu
, ID_PAUSE
, MF_ENABLED
);
220 EnableMenuItem(GetSubMenu(Info
->hShortcutMenu
, 0), ID_PAUSE
, MF_ENABLED
);
221 SendMessage(Info
->hTool
, TB_SETSTATE
, ID_PAUSE
,
222 (LPARAM
)MAKELONG(TBSTATE_ENABLED
, 0));
227 /* disable tools which rely on a selected service */
228 EnableMenuItem(hMainMenu
, ID_PROP
, MF_GRAYED
);
229 EnableMenuItem(hMainMenu
, ID_DELETE
, MF_GRAYED
);
230 EnableMenuItem(GetSubMenu(Info
->hShortcutMenu
, 0), ID_PROP
, MF_GRAYED
);
231 EnableMenuItem(GetSubMenu(Info
->hShortcutMenu
, 0), ID_DELETE
, MF_GRAYED
);
232 SendMessage(Info
->hTool
, TB_SETSTATE
, ID_PROP
,
233 (LPARAM
)MAKELONG(TBSTATE_INDETERMINATE
, 0));
234 SendMessage(Info
->hTool
, TB_SETSTATE
, ID_DELETE
,
235 (LPARAM
)MAKELONG(TBSTATE_INDETERMINATE
, 0));
242 CompareFunc(LPARAM lParam1
, LPARAM lParam2
, LPARAM lParamSort
)
244 PMAIN_WND_INFO Info
= (PMAIN_WND_INFO
)lParamSort
;
245 WCHAR Item1
[256], Item2
[256];
247 ListView_GetItemText(Info
->hListView
, lParam1
, Info
->SortSelection
, Item1
, sizeof(Item1
) / sizeof(WCHAR
));
248 ListView_GetItemText(Info
->hListView
, lParam2
, Info
->SortSelection
, Item2
, sizeof(Item2
) / sizeof(WCHAR
));
250 return wcscmp(Item1
, Item2
) * Info
->SortDirection
;
255 pCreateToolbar(PMAIN_WND_INFO Info
)
257 INT numButtons
= sizeof(Buttons
) / sizeof(Buttons
[0]);
259 Info
->hTool
= CreateWindowEx(0,
262 WS_CHILD
| WS_VISIBLE
| TBSTYLE_FLAT
| TBSTYLE_TOOLTIPS
,
268 if(Info
->hTool
!= NULL
)
270 HIMAGELIST hImageList
;
272 SendMessage(Info
->hTool
,
275 TBSTYLE_EX_HIDECLIPPEDBUTTONS
);
277 SendMessage(Info
->hTool
,
282 hImageList
= InitImageList(IDB_PROP
,
284 GetSystemMetrics(SM_CXSMICON
),
285 GetSystemMetrics(SM_CXSMICON
),
287 if (hImageList
== NULL
)
290 ImageList_Destroy((HIMAGELIST
)SendMessage(Info
->hTool
,
293 (LPARAM
)hImageList
));
295 SendMessage(Info
->hTool
,
307 CreateStatusBar(PMAIN_WND_INFO Info
)
309 INT StatWidths
[] = {110, -1}; /* widths of status bar */
311 Info
->hStatus
= CreateWindowEx(0,
314 WS_CHILD
| WS_VISIBLE
| SBARS_SIZEGRIP
,
317 (HMENU
)IDC_STATUSBAR
,
320 if(Info
->hStatus
== NULL
)
323 SendMessage(Info
->hStatus
,
325 sizeof(StatWidths
) / sizeof(INT
),
333 InitMainWnd(PMAIN_WND_INFO Info
)
335 if (!pCreateToolbar(Info
))
337 DisplayString(L
"error creating toolbar");
341 if (!CreateListView(Info
))
343 DisplayString(L
"error creating list view");
347 if (!CreateStatusBar(Info
))
348 DisplayString(L
"error creating status bar");
350 /* Create Popup Menu */
351 Info
->hShortcutMenu
= LoadMenu(hInstance
,
352 MAKEINTRESOURCE(IDR_POPUP
));
354 Info
->bIsUserAnAdmin
= TRUE
;// IsUserAnAdmin();
355 if (Info
->bIsUserAnAdmin
)
357 HMENU hMainMenu
= GetMenu(Info
->hMainWnd
);
359 SendMessage(Info
->hTool
,
362 (LPARAM
)MAKELONG(TBSTATE_ENABLED
, 0));
365 EnableMenuItem(hMainMenu
,
369 EnableMenuItem(GetSubMenu(Info
->hShortcutMenu
, 0),
379 MainWndCommand(PMAIN_WND_INFO Info
,
383 UNREFERENCED_PARAMETER(hControl
);
389 if (Info
->SelectedItem
!= NO_ITEM_SELECTED
)
391 Info
->bDlgOpen
= TRUE
;
393 Info
->bDlgOpen
= FALSE
;
394 SetMenuAndButtonStates(Info
);
401 RefreshServiceList(Info
);
402 Info
->SelectedItem
= NO_ITEM_SELECTED
;
404 /* disable menus and buttons */
405 SetMenuAndButtonStates(Info
);
407 /* clear the service in the status bar */
408 SendMessage(Info
->hStatus
,
418 SetFocus(Info
->hListView
);
426 ret
= DialogBoxParam(hInstance
,
427 MAKEINTRESOURCE(IDD_DLG_CREATE
),
432 RefreshServiceList(Info
);
434 SetFocus(Info
->hListView
);
440 if (Info
->pCurrentService
->ServiceStatusProcess
.dwCurrentState
!= SERVICE_RUNNING
)
442 DialogBoxParam(hInstance
,
443 MAKEINTRESOURCE(IDD_DLG_DELETE
),
451 LoadString(hInstance
,
454 sizeof(Buf
) / sizeof(WCHAR
));
458 SetFocus(Info
->hListView
);
465 RunActionWithProgress(Info
->hMainWnd
,
466 Info
->pCurrentService
->lpServiceName
,
467 Info
->pCurrentService
->lpDisplayName
,
469 NULL
); //FIXME: Add start params
471 UpdateServiceStatus(Info
->pCurrentService
);
472 ChangeListViewText(Info
, Info
->pCurrentService
, LVSTATUS
);
473 SetMenuAndButtonStates(Info
);
474 SetFocus(Info
->hListView
);
480 RunActionWithProgress(Info
->hMainWnd
,
481 Info
->pCurrentService
->lpServiceName
,
482 Info
->pCurrentService
->lpDisplayName
,
486 UpdateServiceStatus(Info
->pCurrentService
);
487 ChangeListViewText(Info
, Info
->pCurrentService
, LVSTATUS
);
488 SetMenuAndButtonStates(Info
);
489 SetFocus(Info
->hListView
);
494 RunActionWithProgress(Info
->hMainWnd
,
495 Info
->pCurrentService
->lpServiceName
,
496 Info
->pCurrentService
->lpDisplayName
,
500 UpdateServiceStatus(Info
->pCurrentService
);
501 ChangeListViewText(Info
, Info
->pCurrentService
, LVSTATUS
);
502 SetMenuAndButtonStates(Info
);
503 SetFocus(Info
->hListView
);
507 RunActionWithProgress(Info
->hMainWnd
,
508 Info
->pCurrentService
->lpServiceName
,
509 Info
->pCurrentService
->lpDisplayName
,
513 UpdateServiceStatus(Info
->pCurrentService
);
514 ChangeListViewText(Info
, Info
->pCurrentService
, LVSTATUS
);
515 SetMenuAndButtonStates(Info
);
516 SetFocus(Info
->hListView
);
520 RunActionWithProgress(Info
->hMainWnd
,
521 Info
->pCurrentService
->lpServiceName
,
522 Info
->pCurrentService
->lpDisplayName
,
526 UpdateServiceStatus(Info
->pCurrentService
);
527 ChangeListViewText(Info
, Info
->pCurrentService
, LVSTATUS
);
528 SetMenuAndButtonStates(Info
);
529 SetFocus(Info
->hListView
);
534 L
"Help is not yet implemented\n",
536 MB_OK
| MB_ICONINFORMATION
);
537 SetFocus(Info
->hListView
);
541 PostMessage(Info
->hMainWnd
,
548 SetListViewStyle(Info
->hListView
, LVS_ICON
);
549 ListView_Arrange(Info
->hListView
, LVA_DEFAULT
);
551 CheckMenuRadioItem(GetMenu(Info
->hMainWnd
),
559 SetListViewStyle(Info
->hListView
, LVS_SMALLICON
);
560 ListView_Arrange(Info
->hListView
, LVA_DEFAULT
);
562 CheckMenuRadioItem(GetMenu(Info
->hMainWnd
),
570 SetListViewStyle(Info
->hListView
,
572 CheckMenuRadioItem(GetMenu(Info
->hMainWnd
),
579 case ID_VIEW_DETAILS
:
580 SetListViewStyle(Info
->hListView
,
582 CheckMenuRadioItem(GetMenu(Info
->hMainWnd
),
594 MAKEINTRESOURCE(IDD_ABOUTBOX
),
597 SetFocus(Info
->hListView
);
605 MainWndResize(PMAIN_WND_INFO Info
,
609 RECT rcClient
, rcTool
, rcStatus
;
610 int lvHeight
, iToolHeight
, iStatusHeight
;
612 /* Size toolbar and get height */
613 SendMessage(Info
->hTool
, TB_AUTOSIZE
, 0, 0);
614 GetWindowRect(Info
->hTool
, &rcTool
);
615 iToolHeight
= rcTool
.bottom
- rcTool
.top
;
617 /* Size status bar and get height */
618 SendMessage(Info
->hStatus
, WM_SIZE
, 0, 0);
619 GetWindowRect(Info
->hStatus
, &rcStatus
);
620 iStatusHeight
= rcStatus
.bottom
- rcStatus
.top
;
622 /* Calculate remaining height and size list view */
623 GetClientRect(Info
->hMainWnd
, &rcClient
);
624 lvHeight
= rcClient
.bottom
- iToolHeight
- iStatusHeight
;
625 SetWindowPos(Info
->hListView
,
635 static LRESULT CALLBACK
636 MainWndProc(HWND hwnd
,
644 /* Get the window context */
645 Info
= (PMAIN_WND_INFO
)GetWindowLongPtr(hwnd
,
647 if (Info
== NULL
&& msg
!= WM_CREATE
)
649 goto HandleDefaultMessage
;
656 Info
= (PMAIN_WND_INFO
)(((LPCREATESTRUCT
)lParam
)->lpCreateParams
);
658 /* Initialize the main window context */
659 Info
->hMainWnd
= hwnd
;
660 Info
->SelectedItem
= NO_ITEM_SELECTED
;
662 SetWindowLongPtr(hwnd
,
666 if (!InitMainWnd(Info
))
669 /* Fill the list-view before showing the main window */
670 RefreshServiceList(Info
);
672 /* Show the window */
676 SetFocus(Info
->hListView
);
690 LPNMHDR pnmhdr
= (LPNMHDR
)lParam
;
692 switch (pnmhdr
->code
)
700 GetWindowRect(Info
->hListView
, &rect
);
702 if (PtInRect(&rect
, pt
))
707 MAKEWPARAM((WORD
)ID_PROP
, (WORD
)0),
711 //OpenPropSheet(Info);
720 MAKEWPARAM((WORD
)ID_PROP
, (WORD
)0),
725 case LVN_COLUMNCLICK
:
727 LPNMLISTVIEW pnmv
= (LPNMLISTVIEW
) lParam
;
730 /* get pending sort direction for clicked column */
731 hdi
.mask
= HDI_LPARAM
;
732 (void)Header_GetItem(Info
->hHeader
, pnmv
->iSubItem
, &hdi
);
734 /* get new sort parameters */
735 Info
->SortSelection
= pnmv
->iSubItem
;
736 Info
->SortDirection
= hdi
.lParam
;
738 /* set new sort direction and save */
739 hdi
.lParam
= (hdi
.lParam
== ORD_ASCENDING
) ?
740 ORD_DESCENDING
: ORD_ASCENDING
;
742 (void)Header_SetItem(Info
->hHeader
, pnmv
->iSubItem
, &hdi
);
744 (void)ListView_SortItemsEx(Info
->hListView
,
749 case LVN_ITEMCHANGED
:
751 LPNMLISTVIEW pnmv
= (LPNMLISTVIEW
) lParam
;
753 if (pnmv
->uNewState
!= 0)
755 ListViewSelectionChanged(Info
, pnmv
);
756 SetMenuAndButtonStates(Info
);
761 case TTN_GETDISPINFO
:
766 lpttt
= (LPTOOLTIPTEXT
)lParam
;
768 /* Specify the resource identifier of the descriptive
769 * text for the given button. */
770 idButton
= (UINT
)lpttt
->hdr
.idFrom
;
774 lpttt
->lpszText
= MAKEINTRESOURCE(IDS_TOOLTIP_PROP
);
778 lpttt
->lpszText
= MAKEINTRESOURCE(IDS_TOOLTIP_REFRESH
);
782 lpttt
->lpszText
= MAKEINTRESOURCE(IDS_TOOLTIP_EXPORT
);
786 lpttt
->lpszText
= MAKEINTRESOURCE(IDS_TOOLTIP_CREATE
);
790 lpttt
->lpszText
= MAKEINTRESOURCE(IDS_TOOLTIP_DELETE
);
794 lpttt
->lpszText
= MAKEINTRESOURCE(IDS_TOOLTIP_START
);
798 lpttt
->lpszText
= MAKEINTRESOURCE(IDS_TOOLTIP_STOP
);
802 lpttt
->lpszText
= MAKEINTRESOURCE(IDS_TOOLTIP_PAUSE
);
806 lpttt
->lpszText
= MAKEINTRESOURCE(IDS_TOOLTIP_RESTART
);
820 INT xPos
= GET_X_LPARAM(lParam
);
821 INT yPos
= GET_Y_LPARAM(lParam
);
825 /* display popup when cursor is in the list view */
826 GetWindowRect(Info
->hListView
, &lvRect
);
827 if (PtInRect(&lvRect
, pt
))
829 TrackPopupMenuEx(GetSubMenu(Info
->hShortcutMenu
, 0),
844 goto HandleDefaultMessage
;
849 if (Info
->hStatus
!= NULL
)
851 if (!MainWndMenuHint(Info
,
854 sizeof(MainMenuHintTable
) / sizeof(MainMenuHintTable
[0]),
857 MainWndMenuHint(Info
,
860 sizeof(SystemMenuHintTable
) / sizeof(SystemMenuHintTable
[0]),
867 case WM_ENTERMENULOOP
:
869 Info
->bInMenuLoop
= TRUE
;
870 UpdateMainStatusBar(Info
);
874 case WM_EXITMENULOOP
:
876 Info
->bInMenuLoop
= FALSE
;
877 UpdateMainStatusBar(Info
);
883 HeapFree(ProcessHeap
,
887 DestroyMenu(Info
->hShortcutMenu
);
894 HeapFree(ProcessHeap
,
897 SetWindowLongPtr(hwnd
,
907 HandleDefaultMessage
:
909 Ret
= DefWindowProc(hwnd
,
923 CreateMainWindow(LPCTSTR lpCaption
,
927 HWND hMainWnd
= NULL
;
929 Info
= (MAIN_WND_INFO
*) HeapAlloc(ProcessHeap
,
931 sizeof(MAIN_WND_INFO
));
935 Info
->nCmdShow
= nCmdShow
;
937 hMainWnd
= CreateWindowEx(WS_EX_WINDOWEDGE
,
940 WS_OVERLAPPEDWINDOW
| WS_CLIPCHILDREN
| WS_CLIPSIBLINGS
,
949 if (hMainWnd
== NULL
)
952 //ret = GetLastError();
954 HeapFree(ProcessHeap
,
964 InitMainWindowImpl(VOID
)
968 wc
.cbSize
= sizeof(WNDCLASSEX
);
969 wc
.lpfnWndProc
= MainWndProc
;
970 wc
.hInstance
= hInstance
;
971 wc
.hIcon
= LoadIcon(hInstance
,
972 MAKEINTRESOURCE(IDI_SM_ICON
));
973 wc
.hCursor
= LoadCursor(NULL
,
975 wc
.hbrBackground
= (HBRUSH
)(COLOR_BTNFACE
+ 1);
976 wc
.lpszMenuName
= MAKEINTRESOURCE(IDR_MAINMENU
);
977 wc
.lpszClassName
= szMainWndClass
;
978 wc
.hIconSm
= (HICON
)LoadImage(hInstance
,
979 MAKEINTRESOURCE(IDI_SM_ICON
),
985 return RegisterClassEx(&wc
) != (ATOM
)0;
990 UninitMainWindowImpl(VOID
)
992 UnregisterClass(szMainWndClass
,