3 * Copyright (C) 2001, 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS welcome/autorun application
22 * FILE: base/setup/welcome/welcome.c
23 * PROGRAMMERS: Eric Kohl
24 * Casper S. Hornstrup (chorns@users.sourceforge.net)
27 * This utility can be customized by modifying the resources.
28 * Please do NOT change the source code in order to customize this
29 * utility but change the resources!
31 * TODO: Use instead a XML file!
40 #include <reactos/version.h>
46 #define LIGHT_BLUE 0x00F7EFD6
47 #define DARK_BLUE 0x008C7B6B
49 #define TITLE_WIDTH 480
50 #define TITLE_HEIGHT 93
52 #define MAX_NUMBER_TOPICS 10
53 #define TOPIC_DESC_LENGTH 1024
56 * Disable this define if you want to revert back to the old behaviour, i.e.
57 * opening files with CreateProcess. This defines uses ShellExecute instead.
59 #define USE_SHELL_EXECUTE
61 /* GLOBALS ******************************************************************/
63 TCHAR szFrameClass
[] = TEXT("WelcomeWindowClass");
69 HWND hWndDefaultTopic
= NULL
;
74 int nDefaultTopic
= -1;
76 ULONG ulInnerWidth
= TITLE_WIDTH
;
77 ULONG ulInnerHeight
= (TITLE_WIDTH
* 3) / 4;
78 ULONG ulTitleHeight
= TITLE_HEIGHT
+ 3;
80 HBITMAP hTitleBitmap
= NULL
;
81 HBITMAP hDefaultTopicBitmap
= NULL
;
82 HBITMAP hTopicBitmap
[MAX_NUMBER_TOPICS
];
83 HWND hWndTopicButton
[MAX_NUMBER_TOPICS
];
84 HWND hWndCloseButton
= NULL
;
85 HWND hWndCheckButton
= NULL
;
87 HFONT hFontTopicButton
;
88 HFONT hFontTopicTitle
;
89 HFONT hFontTopicDescription
;
90 HFONT hFontCheckButton
;
104 MainWndProc(HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
107 /* FUNCTIONS ****************************************************************/
109 #ifndef USE_SHELL_EXECUTE
111 ShowLastWin32Error(HWND hWnd
)
113 LPTSTR lpMessageBuffer
= NULL
;
114 DWORD dwError
= GetLastError();
116 if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM
,
119 MAKELANGID(LANG_NEUTRAL
, SUBLANG_DEFAULT
),
120 (LPTSTR
)&lpMessageBuffer
,
123 MessageBox(hWnd
, lpMessageBuffer
, szAppTitle
, MB_OK
| MB_ICONERROR
);
128 LocalFree(lpMessageBuffer
);
134 _tWinMain(HINSTANCE hInst
,
135 HINSTANCE hPrevInstance
,
148 DWORD dwStyle
= WS_OVERLAPPED
| WS_CLIPCHILDREN
| WS_CLIPSIBLINGS
|
149 WS_CAPTION
| WS_SYSMENU
| WS_MINIMIZEBOX
;
152 UNREFERENCED_PARAMETER(hPrevInstance
);
153 UNREFERENCED_PARAMETER(lpszCmdLine
);
155 switch (GetUserDefaultUILanguage())
157 case MAKELANGID(LANG_HEBREW
, SUBLANG_DEFAULT
):
158 SetProcessDefaultLayout(LAYOUT_RTL
);
168 hMainIcon
= LoadIcon(hInstance
, MAKEINTRESOURCE(IDI_MAIN
));
170 /* Register the window class */
171 wndclass
.cbSize
= sizeof(WNDCLASSEX
);
172 wndclass
.style
= CS_HREDRAW
| CS_VREDRAW
;
173 wndclass
.lpfnWndProc
= (WNDPROC
)MainWndProc
;
174 wndclass
.cbClsExtra
= 0;
175 wndclass
.cbWndExtra
= 0;
176 wndclass
.hInstance
= hInstance
;
177 wndclass
.hIcon
= hMainIcon
;
178 wndclass
.hIconSm
= NULL
;
179 wndclass
.hCursor
= LoadCursor(NULL
, IDC_ARROW
);
180 wndclass
.hbrBackground
= NULL
;
181 wndclass
.lpszMenuName
= NULL
;
182 wndclass
.lpszClassName
= szFrameClass
;
184 RegisterClassEx(&wndclass
);
186 hTitleBitmap
= LoadBitmap(hInstance
, MAKEINTRESOURCE(IDB_TITLEBITMAP
));
187 if (hTitleBitmap
!= NULL
)
189 GetObject(hTitleBitmap
, sizeof(BITMAP
), &BitmapInfo
);
190 ulInnerWidth
= BitmapInfo
.bmWidth
;
191 ulInnerHeight
= (ulInnerWidth
* 3) / 4;
192 ulTitleHeight
= BitmapInfo
.bmHeight
+ 3;
193 DeleteObject(hTitleBitmap
);
195 ulInnerHeight
-= GetSystemMetrics(SM_CYCAPTION
);
198 rcWindow
.bottom
= ulInnerHeight
- 1;
200 rcWindow
.right
= ulInnerWidth
- 1;
202 AdjustWindowRect(&rcWindow
, dwStyle
, FALSE
);
203 xWidth
= rcWindow
.right
- rcWindow
.left
;
204 yHeight
= rcWindow
.bottom
- rcWindow
.top
;
206 xPos
= (GetSystemMetrics(SM_CXSCREEN
) - xWidth
) / 2;
207 yPos
= (GetSystemMetrics(SM_CYSCREEN
) - yHeight
) / 2;
209 rcTitlePanel
.top
= 0;
210 rcTitlePanel
.bottom
= ulTitleHeight
;
211 rcTitlePanel
.left
= 0;
212 rcTitlePanel
.right
= ulInnerWidth
- 1;
214 rcLeftPanel
.top
= rcTitlePanel
.bottom
;
215 rcLeftPanel
.bottom
= ulInnerHeight
- 1;
216 rcLeftPanel
.left
= 0;
217 rcLeftPanel
.right
= ulInnerWidth
/ 3;
219 rcRightPanel
.top
= rcLeftPanel
.top
;
220 rcRightPanel
.bottom
= rcLeftPanel
.bottom
;
221 rcRightPanel
.left
= rcLeftPanel
.right
;
222 rcRightPanel
.right
= ulInnerWidth
- 1;
224 if (!LoadString(hInstance
, (UINT_PTR
)MAKEINTRESOURCE(IDS_APPTITLE
), szAppTitle
, ARRAYSIZE(szAppTitle
)))
225 _tcscpy(szAppTitle
, TEXT("ReactOS Welcome"));
227 /* Create main window */
228 hWndMain
= CreateWindow(szFrameClass
,
240 hSystemMenu
= GetSystemMenu(hWndMain
, FALSE
);
243 RemoveMenu(hSystemMenu
, SC_SIZE
, MF_BYCOMMAND
);
244 RemoveMenu(hSystemMenu
, SC_MAXIMIZE
, MF_BYCOMMAND
);
247 ShowWindow(hWndMain
, nCmdShow
);
248 UpdateWindow(hWndMain
);
250 while (GetMessage(&msg
, NULL
, 0, 0) != FALSE
)
252 TranslateMessage(&msg
);
253 DispatchMessage(&msg
);
261 ButtonSubclassWndProc(HWND hWnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
265 if (uMsg
== WM_MOUSEMOVE
)
267 i
= GetWindowLongPtr(hWnd
, GWL_ID
);
272 InvalidateRect(hWndMain
, &rcRightPanel
, TRUE
);
276 return CallWindowProc(fnOldBtn
, hWnd
, uMsg
, wParam
, lParam
);
281 RunApplication(int nTopic
)
283 #ifndef USE_SHELL_EXECUTE
284 PROCESS_INFORMATION ProcessInfo
;
285 STARTUPINFO StartupInfo
;
286 TCHAR CurrentDir
[256];
293 InvalidateRect(hWndMain
, NULL
, TRUE
);
295 #ifndef USE_SHELL_EXECUTE
296 GetCurrentDirectory(ARRAYSIZE(CurrentDir
), CurrentDir
);
299 nLength
= LoadString(hInstance
, IDS_TOPICACTION0
+ nTopic
, AppName
, ARRAYSIZE(AppName
));
303 if (!_tcsicmp(AppName
, TEXT("<exit>")))
306 if (!_tcsnicmp(AppName
, TEXT("<msg>"), 5))
308 MessageBox(hWndMain
, AppName
+ 5, TEXT("ReactOS"), MB_OK
| MB_TASKMODAL
);
312 if (_tcsicmp(AppName
, TEXT("explorer.exe")) == 0)
314 #ifndef USE_SHELL_EXECUTE
315 _tcscat(AppName
, TEXT(" "));
316 _tcscat(AppName
, CurrentDir
);
318 _tcscpy(Parameters
, TEXT("\\"));
321 #ifdef USE_SHELL_EXECUTE
328 #ifndef USE_SHELL_EXECUTE
329 ZeroMemory(&StartupInfo
, sizeof(StartupInfo
));
330 StartupInfo
.cb
= sizeof(StartupInfo
);
331 StartupInfo
.lpTitle
= TEXT("Test");
332 StartupInfo
.dwFlags
= STARTF_USESHOWWINDOW
;
333 StartupInfo
.wShowWindow
= SW_SHOWNORMAL
;
335 if (!CreateProcess(NULL
, AppName
, NULL
, NULL
, FALSE
, CREATE_NEW_CONSOLE
,
336 NULL
, CurrentDir
, &StartupInfo
, &ProcessInfo
))
338 ShowLastWin32Error(hWndMain
);
342 CloseHandle(ProcessInfo
.hProcess
);
343 CloseHandle(ProcessInfo
.hThread
);
345 ShellExecute(NULL
, NULL
, AppName
, Parameters
, NULL
, SW_SHOWDEFAULT
);
353 SubclassButton(HWND hWnd
)
355 fnOldBtn
= (WNDPROC
)SetWindowLongPtr(hWnd
, GWL_WNDPROC
, (DWORD_PTR
)ButtonSubclassWndProc
);
360 GetButtonHeight(HDC hDC
,
369 rect
.right
= dwWidth
- 20;
373 hOldFont
= (HFONT
)SelectObject(hDC
, hFont
);
374 DrawText(hDC
, szText
, -1, &rect
, DT_TOP
| DT_CALCRECT
| DT_WORDBREAK
);
375 SelectObject(hDC
, hOldFont
);
377 return (rect
.bottom
-rect
.top
+ 14);
382 OnCreate(HWND hWnd
, WPARAM wParam
, LPARAM lParam
)
390 UNREFERENCED_PARAMETER(wParam
);
391 UNREFERENCED_PARAMETER(lParam
);
393 hbrLightBlue
= CreateSolidBrush(LIGHT_BLUE
);
394 hbrDarkBlue
= CreateSolidBrush(DARK_BLUE
);
395 hbrRightPanel
= CreateSolidBrush(0x00FFFFFF);
397 /* Topic title font */
398 hFontTopicTitle
= CreateFont(-18, 0, 0, 0, FW_NORMAL
,
407 /* Topic description font */
408 hFontTopicDescription
= CreateFont(-11, 0, 0, 0, FW_THIN
,
417 /* Topic button font */
418 hFontTopicButton
= CreateFont(-11, 0, 0, 0, FW_BOLD
,
427 /* Load title bitmap */
428 if (hTitleBitmap
!= NULL
)
429 hTitleBitmap
= LoadBitmap(hInstance
, MAKEINTRESOURCE(IDB_TITLEBITMAP
));
431 /* Load topic bitmaps */
432 hDefaultTopicBitmap
= LoadBitmap(hInstance
, MAKEINTRESOURCE(IDB_DEFAULTTOPICBITMAP
));
433 for (i
= 0; i
< ARRAYSIZE(hTopicBitmap
); i
++)
435 hTopicBitmap
[i
] = LoadBitmap(hInstance
, MAKEINTRESOURCE(IDB_TOPICBITMAP0
+ i
));
438 ScreenDC
= GetWindowDC(hWnd
);
439 hdcMem
= CreateCompatibleDC(ScreenDC
);
440 ReleaseDC(hWnd
, ScreenDC
);
442 /* load and create buttons */
443 dwTop
= rcLeftPanel
.top
;
444 for (i
= 0; i
< ARRAYSIZE(hWndTopicButton
); i
++)
446 nLength
= LoadString(hInstance
, IDS_TOPICBUTTON0
+ i
, szText
, ARRAYSIZE(szText
));
449 dwHeight
= GetButtonHeight(hdcMem
,
452 rcLeftPanel
.right
- rcLeftPanel
.left
);
454 hWndTopicButton
[i
] = CreateWindow(TEXT("BUTTON"),
456 WS_CHILDWINDOW
| WS_VISIBLE
| WS_TABSTOP
| BS_MULTILINE
| BS_OWNERDRAW
,
459 rcLeftPanel
.right
- rcLeftPanel
.left
,
465 hWndDefaultTopic
= hWndTopicButton
[i
];
467 SubclassButton(hWndTopicButton
[i
]);
468 SendMessage(hWndTopicButton
[i
], WM_SETFONT
, (WPARAM
)hFontTopicButton
, MAKELPARAM(TRUE
, 0));
472 hWndTopicButton
[i
] = NULL
;
478 /* Create exit button */
479 nLength
= LoadString(hInstance
, IDS_CLOSETEXT
, szText
, ARRAYSIZE(szText
));
482 hWndCloseButton
= CreateWindow(TEXT("BUTTON"),
484 WS_VISIBLE
| WS_CHILD
| BS_FLAT
,
485 rcRightPanel
.right
- 10 - 57,
486 rcRightPanel
.bottom
- 10 - 21,
490 (HMENU
)IDC_CLOSEBUTTON
,
493 hWndDefaultTopic
= NULL
;
495 SendMessage(hWndCloseButton
, WM_SETFONT
, (WPARAM
)hFontTopicButton
, MAKELPARAM(TRUE
, 0));
499 hWndCloseButton
= NULL
;
502 /* Create checkbox */
503 nLength
= LoadString(hInstance
, IDS_CHECKTEXT
, szText
, ARRAYSIZE(szText
));
506 hFontCheckButton
= CreateFont(-10, 0, 0, 0, FW_THIN
,
515 hWndCheckButton
= CreateWindow(TEXT("BUTTON"),
517 WS_VISIBLE
| WS_CHILD
| BS_AUTOCHECKBOX
,
518 rcLeftPanel
.left
+ 8,
519 rcLeftPanel
.bottom
- 8 - 13,
520 rcLeftPanel
.right
- rcLeftPanel
.left
- 16,
523 (HMENU
)IDC_CHECKBUTTON
,
526 SendMessage(hWndCheckButton
, WM_SETFONT
, (WPARAM
)hFontCheckButton
, MAKELPARAM(TRUE
, 0));
530 hWndCheckButton
= NULL
;
531 hFontCheckButton
= NULL
;
539 OnCommand(HWND hWnd
, WPARAM wParam
, LPARAM lParam
)
541 UNREFERENCED_PARAMETER(lParam
);
543 if (LOWORD(wParam
) == IDC_CLOSEBUTTON
)
547 else if ((LOWORD(wParam
) < MAX_NUMBER_TOPICS
))
549 if (RunApplication(LOWORD(wParam
)) == FALSE
)
557 PaintBanner(HDC hdc
, LPRECT rcPanel
)
563 hOldBitmap
= (HBITMAP
)SelectObject(hdcMem
, hTitleBitmap
);
567 rcPanel
->right
- rcPanel
->left
,
569 hdcMem
, 0, 0, SRCCOPY
);
570 SelectObject(hdcMem
, hOldBitmap
);
573 hOldBrush
= (HBRUSH
)SelectObject(hdc
, hbrDarkBlue
);
577 rcPanel
->right
- rcPanel
->left
,
581 SelectObject(hdc
, hOldBrush
);
586 OnPaint(HWND hWnd
, WPARAM wParam
, LPARAM lParam
)
592 HBITMAP hOldBitmap
= NULL
;
595 RECT rcTitle
, rcDescription
;
596 TCHAR szTopicTitle
[80];
597 TCHAR szTopicDesc
[TOPIC_DESC_LENGTH
];
602 UNREFERENCED_PARAMETER(wParam
);
603 UNREFERENCED_PARAMETER(lParam
);
605 hdc
= BeginPaint(hWnd
, &ps
);
608 PaintBanner(hdc
, &rcTitlePanel
);
611 hOldBrush
= (HBRUSH
)SelectObject(hdc
, hbrLightBlue
);
615 rcLeftPanel
.right
- rcLeftPanel
.left
,
616 rcLeftPanel
.bottom
- rcLeftPanel
.top
,
618 SelectObject(hdc
, hOldBrush
);
621 hOldBrush
= (HBRUSH
)SelectObject(hdc
, WHITE_BRUSH
);
625 rcRightPanel
.right
- rcRightPanel
.left
,
626 rcRightPanel
.bottom
- rcRightPanel
.top
,
628 SelectObject(hdc
, hOldBrush
);
630 /* Draw dark verical line */
631 hPen
= CreatePen(PS_SOLID
, 0, DARK_BLUE
);
632 hOldPen
= (HPEN
)SelectObject(hdc
, hPen
);
633 MoveToEx(hdc
, rcRightPanel
.left
, rcRightPanel
.top
, NULL
);
634 LineTo(hdc
, rcRightPanel
.left
, rcRightPanel
.bottom
);
635 SelectObject(hdc
, hOldPen
);
638 /* Draw topic bitmap */
639 if ((nTopic
== -1) && (hDefaultTopicBitmap
!= NULL
))
641 GetObject(hDefaultTopicBitmap
, sizeof(BITMAP
), &bmpInfo
);
642 hOldBitmap
= (HBITMAP
)SelectObject(hdcMem
, hDefaultTopicBitmap
);
644 rcRightPanel
.right
- bmpInfo
.bmWidth
,
645 rcRightPanel
.bottom
- bmpInfo
.bmHeight
,
653 else if ((nTopic
!= -1) && (hTopicBitmap
[nTopic
] != NULL
))
655 GetObject(hTopicBitmap
[nTopic
], sizeof(BITMAP
), &bmpInfo
);
656 hOldBitmap
= (HBITMAP
)SelectObject(hdcMem
, hTopicBitmap
[nTopic
]);
658 rcRightPanel
.right
- bmpInfo
.bmWidth
,
659 rcRightPanel
.bottom
- bmpInfo
.bmHeight
,
670 nLength
= LoadString(hInstance
, IDS_DEFAULTTOPICTITLE
, szTopicTitle
, ARRAYSIZE(szTopicTitle
));
674 nLength
= LoadString(hInstance
, IDS_TOPICTITLE0
+ nTopic
, szTopicTitle
, ARRAYSIZE(szTopicTitle
));
676 nLength
= LoadString(hInstance
, IDS_DEFAULTTOPICTITLE
, szTopicTitle
, ARRAYSIZE(szTopicTitle
));
681 nLength
= LoadString(hInstance
, IDS_DEFAULTTOPICDESC
, szTopicDesc
, ARRAYSIZE(szTopicDesc
));
685 nLength
= LoadString(hInstance
, IDS_TOPICDESC0
+ nTopic
, szTopicDesc
, ARRAYSIZE(szTopicDesc
));
687 nLength
= LoadString(hInstance
, IDS_DEFAULTTOPICDESC
, szTopicDesc
, ARRAYSIZE(szTopicDesc
));
690 SetBkMode(hdc
, TRANSPARENT
);
692 /* Draw version information */
693 _stprintf(version
, TEXT("ReactOS %d.%d.%d"),
694 KERNEL_VERSION_MAJOR
,
695 KERNEL_VERSION_MINOR
,
696 KERNEL_VERSION_PATCH_LEVEL
);
698 rcTitle
.left
= rcLeftPanel
.left
+ 8;
699 rcTitle
.right
= rcLeftPanel
.right
- 5;
700 rcTitle
.top
= rcLeftPanel
.bottom
- 40;
701 rcTitle
.bottom
= rcLeftPanel
.bottom
- 5;
702 hOldFont
= (HFONT
)SelectObject(hdc
, hFontTopicDescription
);
703 DrawText(hdc
, version
, -1, &rcTitle
, DT_BOTTOM
| DT_CALCRECT
| DT_SINGLELINE
);
704 DrawText(hdc
, version
, -1, &rcTitle
, DT_BOTTOM
| DT_SINGLELINE
);
705 SelectObject(hdc
, hOldFont
);
707 /* Draw topic title */
708 rcTitle
.left
= rcRightPanel
.left
+ 12;
709 rcTitle
.right
= rcRightPanel
.right
- 8;
710 rcTitle
.top
= rcRightPanel
.top
+ 8;
711 rcTitle
.bottom
= rcTitle
.top
+ 57;
712 hOldFont
= (HFONT
)SelectObject(hdc
, hFontTopicTitle
);
713 DrawText(hdc
, szTopicTitle
, -1, &rcTitle
, DT_TOP
| DT_CALCRECT
);
715 SetTextColor(hdc
, DARK_BLUE
);
716 DrawText(hdc
, szTopicTitle
, -1, &rcTitle
, DT_TOP
);
718 /* Draw topic description */
719 rcDescription
.left
= rcRightPanel
.left
+ 12;
720 rcDescription
.right
= rcRightPanel
.right
- 8;
721 rcDescription
.top
= rcTitle
.bottom
+ 8;
722 rcDescription
.bottom
= rcRightPanel
.bottom
- 20;
724 SelectObject(hdc
, hFontTopicDescription
);
725 SetTextColor(hdc
, 0x00000000);
726 DrawText(hdc
, szTopicDesc
, -1, &rcDescription
, DT_TOP
| DT_WORDBREAK
);
728 SetBkMode(hdc
, OPAQUE
);
729 SelectObject(hdc
, hOldFont
);
731 SelectObject(hdcMem
, hOldBrush
);
732 SelectObject(hdcMem
, hOldBitmap
);
741 OnDrawItem(HWND hWnd
, WPARAM wParam
, LPARAM lParam
)
743 LPDRAWITEMSTRUCT lpDis
= (LPDRAWITEMSTRUCT
)lParam
;
749 UNREFERENCED_PARAMETER(hWnd
);
750 UNREFERENCED_PARAMETER(wParam
);
752 if (lpDis
->hwndItem
== hWndCloseButton
)
754 DrawFrameControl(lpDis
->hDC
,
757 DFCS_BUTTONPUSH
| DFCS_FLAT
);
761 if (lpDis
->CtlID
== (ULONG
)nTopic
)
762 hOldBrush
= (HBRUSH
)SelectObject(lpDis
->hDC
, hbrRightPanel
);
764 hOldBrush
= (HBRUSH
)SelectObject(lpDis
->hDC
, hbrLightBlue
);
770 lpDis
->rcItem
.bottom
,
772 SelectObject(lpDis
->hDC
, hOldBrush
);
774 hPen
= CreatePen(PS_SOLID
, 0, DARK_BLUE
);
775 hOldPen
= (HPEN
)SelectObject(lpDis
->hDC
, hPen
);
776 MoveToEx(lpDis
->hDC
, lpDis
->rcItem
.left
, lpDis
->rcItem
.bottom
- 1, NULL
);
777 LineTo(lpDis
->hDC
, lpDis
->rcItem
.right
, lpDis
->rcItem
.bottom
- 1);
778 SelectObject(lpDis
->hDC
, hOldPen
);
781 InflateRect(&lpDis
->rcItem
, -10, -4);
782 OffsetRect(&lpDis
->rcItem
, 0, 1);
783 GetWindowText(lpDis
->hwndItem
, szText
, ARRAYSIZE(szText
));
784 SetTextColor(lpDis
->hDC
, 0x00000000);
785 iBkMode
= SetBkMode(lpDis
->hDC
, TRANSPARENT
);
786 DrawText(lpDis
->hDC
, szText
, -1, &lpDis
->rcItem
, DT_TOP
| DT_LEFT
| DT_WORDBREAK
);
787 SetBkMode(lpDis
->hDC
, iBkMode
);
795 OnMouseMove(HWND hWnd
, WPARAM wParam
, LPARAM lParam
)
797 UNREFERENCED_PARAMETER(wParam
);
798 UNREFERENCED_PARAMETER(lParam
);
804 InvalidateRect(hWndMain
, &rcRightPanel
, TRUE
);
812 OnCtlColorStatic(HWND hWnd
, WPARAM wParam
, LPARAM lParam
)
814 UNREFERENCED_PARAMETER(hWnd
);
816 if ((HWND
)lParam
== hWndCheckButton
)
818 SetBkColor((HDC
)wParam
, LIGHT_BLUE
);
819 return (LRESULT
)hbrLightBlue
;
827 OnActivate(HWND hWnd
, WPARAM wParam
, LPARAM lParam
)
829 UNREFERENCED_PARAMETER(hWnd
);
830 UNREFERENCED_PARAMETER(wParam
);
831 UNREFERENCED_PARAMETER(lParam
);
833 InvalidateRect(hWndMain
, &rcRightPanel
, TRUE
);
840 OnDestroy(HWND hWnd
, WPARAM wParam
, LPARAM lParam
)
844 UNREFERENCED_PARAMETER(hWnd
);
845 UNREFERENCED_PARAMETER(wParam
);
846 UNREFERENCED_PARAMETER(lParam
);
848 for (i
= 0; i
< ARRAYSIZE(hWndTopicButton
); i
++)
850 if (hWndTopicButton
[i
] != NULL
)
851 DestroyWindow(hWndTopicButton
[i
]);
854 if (hWndCloseButton
!= NULL
)
855 DestroyWindow(hWndCloseButton
);
857 if (hWndCheckButton
!= NULL
)
858 DestroyWindow(hWndCheckButton
);
863 DeleteObject(hDefaultTopicBitmap
);
864 DeleteObject(hTitleBitmap
);
865 for (i
= 0; i
< ARRAYSIZE(hTopicBitmap
); i
++)
867 if (hTopicBitmap
[i
] != NULL
)
868 DeleteObject(hTopicBitmap
[i
]);
871 DeleteObject(hFontTopicTitle
);
872 DeleteObject(hFontTopicDescription
);
873 DeleteObject(hFontTopicButton
);
875 if (hFontCheckButton
!= NULL
)
876 DeleteObject(hFontCheckButton
);
878 DeleteObject(hbrLightBlue
);
879 DeleteObject(hbrDarkBlue
);
880 DeleteObject(hbrRightPanel
);
887 MainWndProc(HWND hWnd
,
895 return OnCreate(hWnd
, wParam
, lParam
);
898 return OnCommand(hWnd
, wParam
, lParam
);
901 return OnActivate(hWnd
, wParam
, lParam
);
904 return OnPaint(hWnd
, wParam
, lParam
);
907 return OnDrawItem(hWnd
, wParam
, lParam
);
909 case WM_CTLCOLORSTATIC
:
910 return OnCtlColorStatic(hWnd
, wParam
, lParam
);
913 return OnMouseMove(hWnd
, wParam
, lParam
);
916 OnDestroy(hWnd
, wParam
, lParam
);
921 return DefWindowProc(hWnd
, uMsg
, wParam
, lParam
);