store license on heap and add some error checking

svn path=/trunk/; revision=21481
This commit is contained in:
Ged Murphy 2006-04-06 16:23:35 +00:00
parent 0b431b1a96
commit 0574d19c65

View file

@ -84,7 +84,7 @@ AboutDialogProc(HWND hDlg,
{
HWND hLicenseEditWnd;
HICON hIcon = NULL;
TCHAR strLicense[700];
static LPTSTR lpLicense = NULL;
switch (message)
{
@ -96,27 +96,30 @@ AboutDialogProc(HWND hDlg,
16,
16,
0);
SendMessage(hDlg,
WM_SETICON,
ICON_SMALL,
(LPARAM)hIcon);
if (hIcon != NULL)
{
SendMessage(hDlg,
WM_SETICON,
ICON_SMALL,
(LPARAM)hIcon);
}
hLicenseEditWnd = GetDlgItem(hDlg,
IDC_LICENSE_EDIT);
LoadString(hInstance,
IDS_LICENSE,
strLicense,
sizeof(strLicense) / sizeof(TCHAR));
SetWindowText(hLicenseEditWnd,
strLicense);
if (AllocAndLoadString(&lpLicense,
hInstance,
IDS_LICENSE))
{
SetWindowText(hLicenseEditWnd,
lpLicense);
}
return TRUE;
case WM_COMMAND:
if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
{
LocalFree((HLOCAL)lpLicense);
DestroyIcon(hIcon);
EndDialog(hDlg,
LOWORD(wParam));