[ui] factorize code and remove unused one

* Merge Notification and Question
* Remove bold and url related workarounds
* also switch some files to UTF-8
This commit is contained in:
Pete Batard 2012-11-29 23:14:36 +00:00
parent 454010c27c
commit f1929d7014
6 changed files with 93 additions and 209 deletions

View File

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Licensing Data
* Copyright (c) 2011-2012 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2012 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -22,7 +22,7 @@ const char* about_blurb_format =
"{\\b\\fs20Rufus - The Reliable USB Formatting Utility}\\line\n"
"\\fs18Version %d.%d.%d (Build %d)\\line\n"
"\\line\n"
"Copyright © 2011-2012 Pete Batard / Akeo\\line\n"
"Copyright © 2011-2012 Pete Batard / Akeo\\line\n"
RUFUS_URL "\\line\n"
"\\line\n"
"Report bugs or request enhancements at:\\line\n"

View File

@ -12,8 +12,7 @@
#define IDS_VERSION 108
#define IDI_UP 109
#define IDI_DOWN 110
#define IDD_QUESTION 111
#define IDD_UPDATE_POLICY 112
#define IDD_UPDATE_POLICY 111
#define IDR_BR_MBR_BIN 200
#define IDR_FD_COMMAND_COM 300
#define IDR_FD_KERNEL_SYS 301
@ -70,10 +69,7 @@
#define IDC_EXTRA_PARTITION 1023
#define IDC_ABOUT_LICENSE 1030
#define IDC_ABOUT_ICON 1031
#define IDC_RUFUS_BOLD 1032
#define IDC_ABOUT_COPYRIGHTS 1033
#define IDC_ABOUT_RUFUS_URL 1034
#define IDC_ABOUT_BUG_URL 1035
#define IDC_LICENSE_TEXT 1036
#define IDC_NOTIFICATION_ICON 1040
#define IDC_NOTIFICATION_TEXT 1041
@ -84,7 +80,7 @@
#define IDC_LOG_EDIT 1050
#define IDC_LOG_SAVE 1051
#define IDC_LOG_CLEAR 1052
#define IDC_QUESTION_MORE_INFO 1060
#define IDC_MORE_INFO 1060
#define IDC_UPDATES_POLICY 1061
#define IDC_UPDATE_FREQUENCY 1062
#define IDC_INCLUDE_BETAS 1063
@ -95,7 +91,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 113
#define _APS_NEXT_RESOURCE_VALUE 112
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1065
#define _APS_NEXT_SYMED_VALUE 101

View File

@ -1,6 +1,6 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Copyright (c) 2011-2012 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2012 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1627,7 +1627,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
break;
#ifdef RUFUS_TEST
case IDC_TEST:
testme = Question("Rufus updates", "Do you want to allow " APPLICATION_NAME " to check for updates?\n");
testme = Notification(MSG_QUESTION, IDD_UPDATE_POLICY, UpdateCallback,
"Rufus updates", "Do you want to allow " APPLICATION_NAME " to check for updates?\n");
uprintf("User said %s\n", testme?"YES":"NO");
// CheckForUpdates();
/*
@ -1903,12 +1904,12 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_PAUSED, 0);
SetTaskbarProgressState(TASKBAR_PAUSED);
PrintStatus(0, FALSE, "Cancelled");
Notification(MSG_INFO, "Cancelled", "Operation cancelled by the user.");
Notification(MSG_INFO, 0, NULL, "Cancelled", "Operation cancelled by the user.");
} else {
SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_ERROR, 0);
SetTaskbarProgressState(TASKBAR_ERROR);
PrintStatus(0, FALSE, "FAILED");
Notification(MSG_ERROR, "Error", "Error: %s.%s", StrError(FormatStatus),
Notification(MSG_ERROR, 0, NULL, "Error", "Error: %s.%s", StrError(FormatStatus),
(strchr(StrError(FormatStatus), '\n') != NULL)?"":"\nFor more information, please check the log.");
}
return (INT_PTR)TRUE;

View File

@ -1,6 +1,6 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Copyright (c) 2011-2012 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2012 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -92,8 +92,10 @@ enum user_message_type {
enum notification_type {
MSG_INFO,
MSG_WARNING,
MSG_ERROR
MSG_ERROR,
MSG_QUESTION,
};
typedef INT_PTR (CALLBACK *Callback_t)(HWND, UINT, WPARAM, LPARAM);
/* Timers used throughout the program */
enum timer_type {
@ -225,7 +227,7 @@ extern INT_PTR CreateAboutBox(void);
extern BOOL CreateTooltip(HWND hControl, const char* message, int duration);
extern void DestroyTooltip(HWND hWnd);
extern void DestroyAllTooltips(void);
extern BOOL Notification(int type, char* title, char* format, ...);
extern BOOL Notification(int type, WORD extra_id, Callback_t extra_callback, char* title, char* format, ...);
extern BOOL Question(char* title, char* format, ...);
extern BOOL ExtractDOS(const char* path);
extern BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan);
@ -242,6 +244,7 @@ extern char* FileDialog(BOOL save, char* path, char* filename, char* ext, char*
extern BOOL FileIO(BOOL save, char* path, char** buffer, DWORD* size);
extern LONG GetEntryWidth(HWND hDropDown, const char* entry);
extern BOOL DownloadFile(const char* url, const char* file);
extern INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
extern BOOL CheckForUpdates(void);
extern BOOL IsShown(HWND hDlg);
extern char* get_token_data_file(const char* token, const char* filename);

View File

@ -30,7 +30,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 206, 316
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Rufus v1.2.1.198"
CAPTION "Rufus v1.2.1.199"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,278,50,14
@ -78,18 +78,6 @@ BEGIN
CONTROL "",IDC_ABOUT_BLURB,"RichEdit20W",WS_TABSTOP | 0x884,46,7,235,93
END
IDD_NOTIFICATION DIALOGEX 0, 0, 263, 63
STYLE DS_SETFONT | DS_FIXEDSYS | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CAPTION "Rufus"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "",IDC_NOTIFICATION_LINE,0,0,263,39
CONTROL "",IDC_STATIC,"Static",SS_WHITERECT,0,0,263,38
ICON 32516,IDC_NOTIFICATION_ICON,6,6,20,20
LTEXT "",IDC_NOTIFICATION_TEXT,35,10,219,20
DEFPUSHBUTTON "Close",IDCANCEL,211,44,50,14
END
IDD_ISO_EXTRACT DIALOGEX 0, 0, 262, 66
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION
CAPTION "Copying ISO files..."
@ -120,7 +108,7 @@ BEGIN
PUSHBUTTON "Close Log",IDCANCEL,308,259,50,14
END
IDD_QUESTION DIALOGEX 0, 0, 263, 63
IDD_NOTIFICATION DIALOGEX 0, 0, 263, 63
STYLE DS_SETFONT | DS_FIXEDSYS | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME
CAPTION "Rufus"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@ -130,8 +118,8 @@ BEGIN
ICON 32516,IDC_NOTIFICATION_ICON,6,6,20,20
LTEXT "",IDC_NOTIFICATION_TEXT,35,10,219,20
DEFPUSHBUTTON "No",IDNO,211,44,50,14
DEFPUSHBUTTON "More info...",IDC_QUESTION_MORE_INFO,8,44,50,14
DEFPUSHBUTTON "Yes",IDYES,159,44,50,14
DEFPUSHBUTTON "More info...",IDC_MORE_INFO,8,44,50,14,NOT WS_VISIBLE
DEFPUSHBUTTON "Yes",IDYES,159,44,50,14,NOT WS_VISIBLE
END
IDD_UPDATE_POLICY DIALOGEX 0, 0, 287, 195
@ -231,10 +219,6 @@ BEGIN
BEGIN
END
IDD_NOTIFICATION, DIALOG
BEGIN
END
IDD_ISO_EXTRACT, DIALOG
BEGIN
END
@ -247,7 +231,7 @@ BEGIN
BEGIN
END
IDD_QUESTION, DIALOG
IDD_NOTIFICATION, DIALOG
BEGIN
END
@ -264,8 +248,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,2,1,198
PRODUCTVERSION 1,2,1,198
FILEVERSION 1,2,1,199
PRODUCTVERSION 1,2,1,199
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -282,13 +266,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.2.1.198"
VALUE "FileVersion", "1.2.1.199"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "(c) 2011-2012 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.2.1.198"
VALUE "ProductVersion", "1.2.1.199"
END
END
BLOCK "VarFileInfo"

View File

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Standard Dialog Routines (Browse for folder, About, etc)
* Copyright (c) 2011-2012 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2012 Pete Batard <pete@akeo.ie>
*
* Based on zadig_stdlg.c, part of libwdi: http://libwdi.sf.net
*
@ -63,8 +63,10 @@ static char* szMessageTitle = NULL;
enum WindowsVersion nWindowsVersion = WINDOWS_UNSUPPORTED;
static HWND hBrowseEdit;
static WNDPROC pOrgBrowseWndproc;
HFONT hBoldFont = NULL;
static const SETTEXTEX friggin_microsoft_unicode_amateurs = {ST_DEFAULT, CP_UTF8};
static BOOL notification_is_question;
static WORD notification_info_id;
static Callback_t notification_info_callback;
/*
* Detect Windows version
@ -561,30 +563,6 @@ fallback:
return filepath;
}
void CreateBoldFont(HDC dc) {
TEXTMETRIC tm;
LOGFONT lf;
if (hBoldFont != NULL)
return;
GetTextMetrics(dc, &tm);
lf.lfHeight = tm.tmHeight+1;
lf.lfWidth = tm.tmAveCharWidth+1;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = FW_BOLD;
lf.lfItalic = tm.tmItalic;
lf.lfUnderline = FALSE;
lf.lfStrikeOut = tm.tmStruckOut;
lf.lfCharSet = tm.tmCharSet;
lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfPitchAndFamily = tm.tmPitchAndFamily;
GetTextFace(dc, LF_FACESIZE, lf.lfFaceName);
hBoldFont = CreateFontIndirect(&lf);
}
/*
* Create the application status bar
*/
@ -696,14 +674,6 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
SendMessage(hEdit[i], EM_SETBKGNDCOLOR, 0, (LPARAM)GetSysColor(COLOR_BTNFACE));
}
break;
case WM_CTLCOLORSTATIC:
if ((HWND)lParam == GetDlgItem(hDlg, IDC_RUFUS_BOLD)) {
CreateBoldFont((HDC)wParam);
SetBkMode((HDC)wParam, TRANSPARENT);
SelectObject((HDC)wParam, hBoldFont);
return (INT_PTR)CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
}
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case EN_LINK:
@ -738,53 +708,6 @@ INT_PTR CreateAboutBox(void)
return DialogBoxA(hMainInstance, MAKEINTRESOURCEA(IDD_ABOUTBOX), hMainDialog, AboutCallback);
}
/*
* Update policy and settings dialog callback
*/
INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND hPolicy, hCombo;
switch (message) {
case WM_INITDIALOG:
CenterDialog(hDlg);
hCombo = GetDlgItem(hDlg, IDC_UPDATE_FREQUENCY);
IGNORE_RETVAL(ComboBox_SetItemData(hCombo, ComboBox_AddStringU(hCombo, "Never (Disabled)"), -1));
IGNORE_RETVAL(ComboBox_SetItemData(hCombo, ComboBox_AddStringU(hCombo, "Daily (Default)"), 86400));
IGNORE_RETVAL(ComboBox_SetItemData(hCombo, ComboBox_AddStringU(hCombo, "Weekly"), 604800));
IGNORE_RETVAL(ComboBox_SetItemData(hCombo, ComboBox_AddStringU(hCombo, "Monthly"), 2629800));
IGNORE_RETVAL(ComboBox_SetCurSel(hCombo, 1));
hCombo = GetDlgItem(hDlg, IDC_INCLUDE_BETAS);
IGNORE_RETVAL(ComboBox_AddStringU(hCombo, "No"));
IGNORE_RETVAL(ComboBox_AddStringU(hCombo, "Yes"));
IGNORE_RETVAL(ComboBox_SetCurSel(hCombo, 0));
hPolicy = GetDlgItem(hDlg, IDC_UPDATES_POLICY);
SendMessage(hPolicy, EM_AUTOURLDETECT, 1, 0);
SendMessageA(hPolicy, EM_SETTEXTEX, (WPARAM)&friggin_microsoft_unicode_amateurs, (LPARAM)update_policy);
SendMessage(hPolicy, EM_SETSEL, -1, -1);
SendMessage(hPolicy, EM_SETEVENTMASK, 0, ENM_LINK);
SendMessageA(hPolicy, EM_SETBKGNDCOLOR, 0, (LPARAM)GetSysColor(COLOR_BTNFACE));
break;
case WM_CTLCOLORSTATIC:
if ((HWND)lParam == GetDlgItem(hDlg, IDC_RUFUS_BOLD)) {
CreateBoldFont((HDC)wParam);
SetBkMode((HDC)wParam, TRANSPARENT);
SelectObject((HDC)wParam, hBoldFont);
return (INT_PTR)CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
}
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}
/*
* We use our own MessageBox for notifications to have greater control (center, no close button, etc)
*/
@ -810,6 +733,15 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP
if (szMessageTitle != NULL) {
SetWindowTextA(hDlg, szMessageTitle);
}
// Enable/disable the buttons and set text
if (!notification_is_question) {
SetWindowTextA(GetDlgItem(hDlg, IDNO), "Close");
} else {
ShowWindow(GetDlgItem(hDlg, IDYES), SW_SHOW);
}
if (notification_info_callback != NULL) {
ShowWindow(GetDlgItem(hDlg, IDC_MORE_INFO), SW_SHOW);
}
// Set the control text
if (szMessageText != NULL) {
SetWindowTextA(GetDlgItem(hDlg, IDC_NOTIFICATION_TEXT), szMessageText);
@ -835,8 +767,13 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP
switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
case IDYES:
case IDNO:
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
case IDC_MORE_INFO:
DialogBoxA(hMainInstance, MAKEINTRESOURCEA(notification_info_id), hDlg, notification_info_callback);
break;
}
break;
}
@ -846,8 +783,9 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP
/*
* Display a custom notification
*/
BOOL Notification(int type, char* title, char* format, ...)
BOOL Notification(int type, WORD extra_id, Callback_t extra_callback, char* title, char* format, ...)
{
BOOL ret;
va_list args;
szMessageText = (char*)malloc(MAX_PATH);
if (szMessageText == NULL) return FALSE;
@ -856,6 +794,9 @@ BOOL Notification(int type, char* title, char* format, ...)
safe_vsnprintf(szMessageText, MAX_PATH-1, format, args);
va_end(args);
szMessageText[MAX_PATH-1] = 0;
notification_info_callback = extra_callback;
notification_info_id = extra_id;
notification_is_question = FALSE;
switch(type) {
case MSG_WARNING:
@ -864,97 +805,16 @@ BOOL Notification(int type, char* title, char* format, ...)
case MSG_ERROR:
hMessageIcon = LoadIcon(NULL, IDI_ERROR);
break;
case MSG_QUESTION:
hMessageIcon = LoadIcon(NULL, IDI_QUESTION);
notification_is_question = TRUE;
break;
case MSG_INFO:
default:
hMessageIcon = LoadIcon(NULL, IDI_INFORMATION);
break;
}
DialogBox(hMainInstance, MAKEINTRESOURCE(IDD_NOTIFICATION), hMainDialog, NotificationCallback);
safe_free(szMessageText);
return TRUE;
}
/*
* Same for custom questions
*/
INT_PTR CALLBACK QuestionCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT loc;
int i;
// Prevent resizing
static LRESULT disabled[9] = { HTLEFT, HTRIGHT, HTTOP, HTBOTTOM, HTSIZE,
HTTOPLEFT, HTTOPRIGHT, HTBOTTOMLEFT, HTBOTTOMRIGHT };
static HBRUSH white_brush, separator_brush;
switch (message) {
case WM_INITDIALOG:
white_brush = CreateSolidBrush(WHITE);
separator_brush = CreateSolidBrush(SEPARATOR_GREY);
CenterDialog(hDlg);
// Change the default icon
if (Static_SetIcon(GetDlgItem(hDlg, IDC_NOTIFICATION_ICON), hMessageIcon) == 0) {
uprintf("Could not set dialog icon\n");
}
// Set the dialog title
if (szMessageTitle != NULL) {
SetWindowTextA(hDlg, szMessageTitle);
}
// Set the control text
if (szMessageText != NULL) {
SetWindowTextA(GetDlgItem(hDlg, IDC_NOTIFICATION_TEXT), szMessageText);
}
return (INT_PTR)TRUE;
case WM_CTLCOLORSTATIC:
// Change the background colour for static text and icon
SetBkMode((HDC)wParam, TRANSPARENT);
if ((HWND)lParam == GetDlgItem(hDlg, IDC_NOTIFICATION_LINE)) {
return (INT_PTR)separator_brush;
}
return (INT_PTR)white_brush;
case WM_NCHITTEST:
// Check coordinates to prevent resize actions
loc = DefWindowProc(hDlg, message, wParam, lParam);
for(i = 0; i < 9; i++) {
if (loc == disabled[i]) {
return (INT_PTR)TRUE;
}
}
return (INT_PTR)FALSE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDYES:
case IDNO:
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
case IDC_QUESTION_MORE_INFO:
DialogBoxA(hMainInstance, MAKEINTRESOURCEA(IDD_UPDATE_POLICY), hDlg, UpdateCallback);
break;
}
break;
}
return (INT_PTR)FALSE;
}
/*
* Display a custom question
* returns TRUE if the user answered yes, FALSE if no
* TODO: point to a static dialog for more info
*/
BOOL Question(char* title, char* format, ...)
{
va_list args;
BOOL ret;
szMessageText = (char*)malloc(MAX_PATH);
if (szMessageText == NULL) return FALSE;
szMessageTitle = title;
va_start(args, format);
safe_vsnprintf(szMessageText, MAX_PATH-1, format, args);
va_end(args);
szMessageText[MAX_PATH-1] = 0;
hMessageIcon = LoadIcon(NULL, IDI_QUESTION);
ret = (DialogBox(hMainInstance, MAKEINTRESOURCE(IDD_QUESTION), hMainDialog, QuestionCallback) == IDYES);
ret = (DialogBox(hMainInstance, MAKEINTRESOURCE(IDD_NOTIFICATION), hMainDialog, NotificationCallback) == IDYES);
safe_free(szMessageText);
return ret;
}
@ -1236,3 +1096,43 @@ BOOL SetTaskbarProgressValue(ULONGLONG ullCompleted, ULONGLONG ullTotal)
return !FAILED(ptbl->lpVtbl->SetProgressValue(ptbl, hMainDialog, ullCompleted, ullTotal));
}
#pragma pop_macro("INTERFACE")
/*
* Update policy and settings dialog callback
*/
INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND hPolicy, hCombo;
switch (message) {
case WM_INITDIALOG:
CenterDialog(hDlg);
hCombo = GetDlgItem(hDlg, IDC_UPDATE_FREQUENCY);
IGNORE_RETVAL(ComboBox_SetItemData(hCombo, ComboBox_AddStringU(hCombo, "Disabled"), -1));
IGNORE_RETVAL(ComboBox_SetItemData(hCombo, ComboBox_AddStringU(hCombo, "Daily (Default)"), 86400));
IGNORE_RETVAL(ComboBox_SetItemData(hCombo, ComboBox_AddStringU(hCombo, "Weekly"), 604800));
IGNORE_RETVAL(ComboBox_SetItemData(hCombo, ComboBox_AddStringU(hCombo, "Monthly"), 2629800));
IGNORE_RETVAL(ComboBox_SetCurSel(hCombo, 1));
hCombo = GetDlgItem(hDlg, IDC_INCLUDE_BETAS);
IGNORE_RETVAL(ComboBox_AddStringU(hCombo, "No"));
IGNORE_RETVAL(ComboBox_AddStringU(hCombo, "Yes"));
IGNORE_RETVAL(ComboBox_SetCurSel(hCombo, 0));
hPolicy = GetDlgItem(hDlg, IDC_UPDATES_POLICY);
SendMessage(hPolicy, EM_AUTOURLDETECT, 1, 0);
SendMessageA(hPolicy, EM_SETTEXTEX, (WPARAM)&friggin_microsoft_unicode_amateurs, (LPARAM)update_policy);
SendMessage(hPolicy, EM_SETSEL, -1, -1);
SendMessage(hPolicy, EM_SETEVENTMASK, 0, ENM_LINK);
SendMessageA(hPolicy, EM_SETBKGNDCOLOR, 0, (LPARAM)GetSysColor(COLOR_BTNFACE));
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}