- Create KD branch. All debugging support is removed in this branch (no symbols,...
[reactos.git] / reactos / dll / cpl / sysdm / licence.c
1 /*
2 * PROJECT: ReactOS System Control Panel Applet
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/cpl/sysdm/general.c
5 * PURPOSE: Licence dialog box message handler
6 * COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
7 *
8 */
9
10 #include "precomp.h"
11
12
13 INT_PTR CALLBACK
14 LicenceDlgProc(HWND hDlg,
15 UINT message,
16 WPARAM wParam,
17 LPARAM lParam)
18 {
19 HRSRC hResInfo;
20 HGLOBAL hResMem;
21 WCHAR *LicenseText;
22 static HICON hIcon;
23
24 UNREFERENCED_PARAMETER(lParam);
25
26 switch (message)
27 {
28 case WM_INITDIALOG:
29 {
30 hIcon = LoadImage(hApplet,
31 MAKEINTRESOURCE(IDI_CPLSYSTEM),
32 IMAGE_ICON,
33 16,
34 16,
35 0);
36
37 SendMessage(hDlg,
38 WM_SETICON,
39 ICON_SMALL,
40 (LPARAM)hIcon);
41
42 /* load license from resource */
43 if(!(hResInfo = FindResource(hApplet,
44 MAKEINTRESOURCE(RC_LICENSE),
45 MAKEINTRESOURCE(RTDATA))) ||
46 !(hResMem = LoadResource(hApplet, hResInfo)) ||
47 !(LicenseText = LockResource(hResMem)))
48 {
49 ShowLastWin32Error(hDlg);
50 break;
51 }
52
53 /* insert the license into the edit control (unicode!) */
54 SetDlgItemText(hDlg,
55 IDC_LICENCEEDIT,
56 LicenseText);
57
58 SendDlgItemMessage(hDlg,
59 IDC_LICENCEEDIT,
60 EM_SETSEL,
61 -1,
62 0);
63
64 return TRUE;
65 }
66
67 case WM_COMMAND:
68 {
69 if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
70 {
71 DestroyIcon(hIcon);
72 EndDialog(hDlg,
73 LOWORD(wParam));
74 return TRUE;
75 }
76 }
77 break;
78 }
79
80 return FALSE;
81 }