Remove the TABs again, sorry that was a bad idea
[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 PostMessage(GetDlgItem(hDlg, IDC_LICENCEEDIT),
59 EM_SETSEL,
60 -1,
61 0);
62
63 return TRUE;
64 }
65
66 case WM_COMMAND:
67 {
68 if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
69 {
70 DestroyIcon(hIcon);
71 EndDialog(hDlg,
72 LOWORD(wParam));
73 return TRUE;
74 }
75 }
76 break;
77 }
78
79 return FALSE;
80 }