Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenlicence.c
Go to the documentation of this file.
00001 /* 00002 * PROJECT: ReactOS System Control Panel Applet 00003 * LICENSE: GPL - See COPYING in the top level directory 00004 * FILE: dll/cpl/sysdm/general.c 00005 * PURPOSE: Licence dialog box message handler 00006 * COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com> 00007 * 00008 */ 00009 00010 #include "precomp.h" 00011 00012 typedef struct _LIC_CONTEXT 00013 { 00014 HICON hIcon; 00015 } LIC_CONTEXT, *PLIC_CONTEXT; 00016 00017 00018 static BOOL 00019 OnInitDialog(HWND hDlg, PLIC_CONTEXT pLicInfo) 00020 { 00021 HRSRC hResInfo; 00022 HGLOBAL hResMem; 00023 WCHAR *LicenseText; 00024 00025 pLicInfo->hIcon = LoadImage(hApplet, 00026 MAKEINTRESOURCE(IDI_CPLSYSTEM), 00027 IMAGE_ICON, 00028 16, 00029 16, 00030 0); 00031 00032 SendMessage(hDlg, 00033 WM_SETICON, 00034 ICON_SMALL, 00035 (LPARAM)pLicInfo->hIcon); 00036 00037 /* Load license from resource */ 00038 if (!(hResInfo = FindResource(hApplet, 00039 MAKEINTRESOURCE(RC_LICENSE), 00040 MAKEINTRESOURCE(RTDATA))) || 00041 !(hResMem = LoadResource(hApplet, hResInfo)) || 00042 !(LicenseText = LockResource(hResMem))) 00043 { 00044 ShowLastWin32Error(hDlg); 00045 return FALSE; 00046 } 00047 00048 /* Insert the license into the edit control (unicode!) */ 00049 SetDlgItemText(hDlg, 00050 IDC_LICENCEEDIT, 00051 LicenseText); 00052 00053 PostMessage(GetDlgItem(hDlg, IDC_LICENCEEDIT), 00054 EM_SETSEL, 00055 -1, 00056 0); 00057 PostMessage(GetDlgItem(hDlg, IDC_LICENCEEDIT), WM_VSCROLL, SB_TOP, 0); 00058 return TRUE; 00059 } 00060 00061 00062 INT_PTR CALLBACK 00063 LicenceDlgProc(HWND hDlg, 00064 UINT uMsg, 00065 WPARAM wParam, 00066 LPARAM lParam) 00067 { 00068 PLIC_CONTEXT pLicInfo; 00069 00070 UNREFERENCED_PARAMETER(lParam); 00071 00072 pLicInfo = (PLIC_CONTEXT)GetWindowLongPtr(hDlg, DWLP_USER); 00073 00074 switch (uMsg) 00075 { 00076 case WM_INITDIALOG: 00077 pLicInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LIC_CONTEXT)); 00078 if (pLicInfo == NULL) 00079 { 00080 EndDialog(hDlg, 0); 00081 return FALSE; 00082 } 00083 SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)pLicInfo); 00084 return OnInitDialog(hDlg, pLicInfo); 00085 00086 case WM_DESTROY: 00087 if (pLicInfo) 00088 { 00089 DestroyIcon(pLicInfo->hIcon); 00090 HeapFree(GetProcessHeap(), 0, pLicInfo); 00091 } 00092 break; 00093 00094 case WM_COMMAND: 00095 if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) 00096 { 00097 EndDialog(hDlg, 00098 LOWORD(wParam)); 00099 return TRUE; 00100 } 00101 break; 00102 } 00103 00104 return FALSE; 00105 } Generated on Sun May 27 2012 04:17:10 for ReactOS by
1.7.6.1
|