Coding style clean-up. No code changes.
[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 uMsg,
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 (uMsg)
27 {
28 case WM_INITDIALOG:
29 hIcon = LoadImage(hApplet,
30 MAKEINTRESOURCE(IDI_CPLSYSTEM),
31 IMAGE_ICON,
32 16,
33 16,
34 0);
35
36 SendMessage(hDlg,
37 WM_SETICON,
38 ICON_SMALL,
39 (LPARAM)hIcon);
40
41 /* load license from resource */
42 if(!(hResInfo = FindResource(hApplet,
43 MAKEINTRESOURCE(RC_LICENSE),
44 MAKEINTRESOURCE(RTDATA))) ||
45 !(hResMem = LoadResource(hApplet, hResInfo)) ||
46 !(LicenseText = LockResource(hResMem)))
47 {
48 ShowLastWin32Error(hDlg);
49 break;
50 }
51
52 /* insert the license into the edit control (unicode!) */
53 SetDlgItemText(hDlg,
54 IDC_LICENCEEDIT,
55 LicenseText);
56
57 PostMessage(GetDlgItem(hDlg, IDC_LICENCEEDIT),
58 EM_SETSEL,
59 -1,
60 0);
61
62 return TRUE;
63
64 case WM_COMMAND:
65 if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
66 {
67 DestroyIcon(hIcon);
68 EndDialog(hDlg,
69 LOWORD(wParam));
70 return TRUE;
71 }
72 break;
73 }
74
75 return FALSE;
76 }