ReactOS 0.4.15-dev-7931-gfd331f1
licence.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS System Control Panel Applet
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/cpl/sysdm/licence.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
12typedef struct _LIC_CONTEXT
13{
17
18
19static BOOL
21{
22 HRSRC hResInfo;
23 HGLOBAL hResMem;
24 PCSTR LicenseText;
25
26 pLicInfo->hIcon = LoadImage(hApplet,
32 pLicInfo->hIconSm = LoadImage(hApplet,
38
39 SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)pLicInfo->hIcon);
40 SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)pLicInfo->hIconSm);
41
42 /* Load license from resource */
43 if (!(hResInfo = FindResource(hApplet,
46 !(hResMem = LoadResource(hApplet, hResInfo)) ||
47 !(LicenseText = LockResource(hResMem)))
48 {
50 return FALSE;
51 }
52
53 /* Insert the license into the edit control */
54 SetDlgItemTextA(hDlg,
56 LicenseText);
57
60 -1,
61 0);
63 return TRUE;
64}
65
66
69 UINT uMsg,
72{
73 PLIC_CONTEXT pLicInfo;
74
76
77 pLicInfo = (PLIC_CONTEXT)GetWindowLongPtr(hDlg, DWLP_USER);
78
79 switch (uMsg)
80 {
81 case WM_INITDIALOG:
83 if (pLicInfo == NULL)
84 {
85 EndDialog(hDlg, 0);
86 return FALSE;
87 }
88 SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)pLicInfo);
89 return OnInitDialog(hDlg, pLicInfo);
90
91 case WM_DESTROY:
92 if (pLicInfo)
93 {
94 if (pLicInfo->hIconSm)
95 DestroyIcon(pLicInfo->hIconSm);
96
97 if (pLicInfo->hIcon)
98 DestroyIcon(pLicInfo->hIcon);
99
100 HeapFree(GetProcessHeap(), 0, pLicInfo);
101 }
102 break;
103
104 case WM_COMMAND:
105 if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
106 {
107 EndDialog(hDlg,
108 LOWORD(wParam));
109 return TRUE;
110 }
111 break;
112 }
113
114 return FALSE;
115}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
INT_PTR CALLBACK LicenceDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: licence.c:68
static BOOL OnInitDialog(HWND hDlg, PLIC_CONTEXT pLicInfo)
Definition: licence.c:20
struct _LIC_CONTEXT * PLIC_CONTEXT
struct _LIC_CONTEXT LIC_CONTEXT
#define RTDATA
Definition: resource.h:228
#define IDI_LICENSE
Definition: resource.h:9
#define IDC_LICENCEEDIT
Definition: resource.h:226
#define RC_LICENSE
Definition: resource.h:227
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
unsigned int BOOL
Definition: ntddk_ex.h:94
static HICON
Definition: imagelist.c:84
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define LOWORD(l)
Definition: pedump.c:82
HICON hIconSm
Definition: licence.c:15
HICON hIcon
Definition: licence.c:14
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
const char * PCSTR
Definition: typedefs.h:52
#define FindResource
Definition: winbase.h:3793
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define DWLP_USER
Definition: winuser.h:872
#define IDCANCEL
Definition: winuser.h:831
#define IMAGE_ICON
Definition: winuser.h:212
#define WM_VSCROLL
Definition: winuser.h:1744
#define WM_COMMAND
Definition: winuser.h:1740
#define SM_CYSMICON
Definition: winuser.h:1013
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:830
#define SM_CXSMICON
Definition: winuser.h:1012
#define SM_CYICON
Definition: winuser.h:973
#define SendMessage
Definition: winuser.h:5843
#define EM_SETSEL
Definition: winuser.h:2018
BOOL WINAPI SetDlgItemTextA(_In_ HWND, _In_ int, _In_ LPCSTR)
#define PostMessage
Definition: winuser.h:5832
#define LoadImage
Definition: winuser.h:5815
#define SB_TOP
Definition: winuser.h:578
#define LR_DEFAULTCOLOR
Definition: winuser.h:1087
#define WM_DESTROY
Definition: winuser.h:1609
#define SM_CXICON
Definition: winuser.h:972
#define MAKEINTRESOURCE
Definition: winuser.h:591
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2053
void ShowLastWin32Error(HWND hwndParent)
Definition: winutils.c:11