- // dialog_about.cpp 
-   
- #include "../common.h" 
-   
-   
- // dialog template 
- #define THIS_DIALOG DIALOG_ABOUT 
-   
-   
- // global variables used in this module only 
- static HFONT hFontBanner; 
-   
-   
- // prototypes of local functions 
- static void StartThread_ThisDialog (void *thread_parms); 
- static int CALLBACK DialogProc_ThisDialog (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam); 
-   
-   
- void DialogBox_About (void) 
- { 
-    // helper function to fire up the modeless dialog box 
-   
-    is_dialogbox_displayed = true; 
-    _beginthread (StartThread_ThisDialog, 0, NULL); // fire up a new one 
-   
-    return; // return as soon as the thread is fired up 
- } 
-   
-   
- void DialogBox_About_Validated (void) 
- { 
-    // callback function called by the main game thread when the dialog box is validated 
-   
-    // remember this callback is no longer to be called 
-    is_dialogbox_about_validated = false; 
-   
-    return; // finished 
- } 
-   
-   
- static void StartThread_ThisDialog (void *thread_parms) 
- { 
-    // this function runs in a separate thread, for that's the only way (seemingly) 
-    // to implement a non-modal message box using the Common Controls library. 
-   
-    // create the banner font 
-    hFontBanner = CreateFont (42, 0, 0, 0, FW_DONTCARE, true, false, false, ANSI_CHARSET, OUT_DEFAULT_PRECIS, 
-                              CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, L"Papyrus"); 
-   
-    // display the dialog box 
-    if (DialogBox (hAppInstance, MAKEINTRESOURCE (THIS_DIALOG), hMainWnd, DialogProc_ThisDialog) == 1) 
-       is_dialogbox_about_validated = true; 
-    is_dialogbox_displayed = false; 
-   
-    // destroy the font object we used 
-    DeleteObject (hFontBanner); 
-   
-    the_board.reevaluate = true; // refresh the GUI buttons if needed 
-    return; // _endthread() implied 
- } 
-   
-   
- static int CALLBACK DialogProc_ThisDialog (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam) 
- { 
-    // message handler for the dialog box 
-   
-    static wchar_t temp_buffer[256]; 
-    static wchar_t wide_version[32]; 
-    static char version[32]; 
-   
-    unsigned short wParam_hiword; 
-    unsigned short wParam_loword; 
-   
-    // filter out the commonly used message values 
-    wParam_hiword = HIWORD (wParam); 
-    wParam_loword = LOWORD (wParam); 
-   
-    // have we just fired up this window ? 
-    if (message == WM_INITDIALOG) 
-    { 
-       // center the window 
-       CenterWindow (hWnd, hMainWnd); 
-   
-       // set dialog icons (small one for title bar & big one for task manager) 
-       SendMessage (hWnd, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon (hAppInstance, MAKEINTRESOURCE (ICON_MAIN))); 
-       SendMessage (hWnd, WM_SETICON, ICON_BIG, (LPARAM) LoadIcon (hAppInstance, MAKEINTRESOURCE (ICON_MAIN))); 
-   
-       // set window title and control texts 
-       SetWindowText (hWnd, LOCALIZE (L"AboutBox_Title")); 
-   
-       // set the banner area font 
-       SendMessage (GetDlgItem (hWnd, STATICTEXT_BANNER), WM_SETFONT, (WPARAM) hFontBanner, false); 
-       Static_SetText (GetDlgItem (hWnd, STATICTEXT_BANNER), PROGRAM_NAME); 
-   
-       GenerateVersionNumber (version, sizeof (version)); 
-       ConvertToWideChar (wide_version, WCHAR_SIZEOF (wide_version), version); 
-       swprintf_s (temp_buffer, WCHAR_SIZEOF (temp_buffer), L"version %s © 2010-%.4s Pierre-Marie Baty - ", wide_version, wide_version); 
-       Static_SetText (GetDlgItem (hWnd, STATICTEXT_PROGRAMVERSION), temp_buffer); 
-       Static_SetText (GetDlgItem (hWnd, STATICTEXT_AUTHOREMAIL), AUTHOR_EMAIL); 
-       Static_SetText (GetDlgItem (hWnd, STATICTEXT_ABOUTBOX_1STPARAGRAPH), LOCALIZE (L"AboutBox_1stParagraph")); 
-       Static_SetText (GetDlgItem (hWnd, STATICTEXT_ABOUTBOX_2NDPARAGRAPH), LOCALIZE (L"AboutBox_2ndParagraph")); 
-       SetWindowText (GetDlgItem (hWnd, BUTTON_WEBSITE), LOCALIZE (L"AboutBox_VisitWebsite")); 
-   
-       // build the "registered to:" message and display it 
-       if (is_registered) 
-          swprintf_s (temp_buffer, WCHAR_SIZEOF (temp_buffer), LOCALIZE (L"Registration_RegisteredTo"), options.registration.user_email); 
-       else 
-          wcscpy_s (temp_buffer, WCHAR_SIZEOF (temp_buffer), LOCALIZE (L"Registration_Unregistered")); 
-       Static_SetText (GetDlgItem (hWnd, STATICTEXT_REGISTEREDTO), temp_buffer); 
-   
-       // convert the author's email to something clickable 
-       ConvertStaticToHyperlink (GetDlgItem (hWnd, STATICTEXT_AUTHOREMAIL)); 
-    } 
-   
-    // else did we click the close button on the title bar ? 
-    else if (message == WM_CLOSE) 
-       EndDialog (hWnd, 0); // close the dialog box 
-   
-    // else did we take action on one of the controls ? 
-    else if (message == WM_COMMAND) 
-    { 
-       // was it the website button ? 
-       if (wParam_loword == BUTTON_WEBSITE) 
-       { 
-          ShellExecute (NULL, L"open", PROGRAM_URL, NULL, NULL, SW_MAXIMIZE); // open the website in the default browser, maximized 
-          EndDialog (hWnd, 0); // close the dialog box 
-       } 
-   
-       // else was it the author's email ? 
-       else if (wParam_loword == STATICTEXT_AUTHOREMAIL) 
-          ShellExecute (NULL, L"open", L"mailto:" AUTHOR_EMAIL, NULL, NULL, SW_MAXIMIZE); // fire up the mail client 
-   
-       // else did we cancel the dialog box ? (IDCANCEL is a system-wide dialog box handler value, that catches the ESC key) 
-       else if (wParam_loword == IDCANCEL) 
-          EndDialog (hWnd, 0); // close the dialog box 
-    } 
-   
-    // call the default dialog message processing function to keep things going 
-    return (false); 
- } 
-