- // dialog_about.cpp 
-   
- #include "../common.h" 
-   
-   
- // dialog template 
- #define THIS_DIALOG DIALOG_ABOUT 
-   
-   
- // global variables used in this module only 
- static bool is_authordisplayed = false; 
- 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 
-   
-    _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; 
-   
-    // destroy the font object we used 
-    DeleteObject (hFontBanner); 
-   
-    return; // _endthread() implied 
- } 
-   
-   
- static int CALLBACK DialogProc_ThisDialog (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam) 
- { 
-    // message handler for the dialog box 
-   
-    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); 
-   
-       Static_SetText (GetDlgItem (hWnd, STATICTEXT_PROGRAMVERSION), L"version " PROGRAM_VERSION L" " PROGRAM_COPYRIGHT L" " AUTHOR_NAME L" - "); 
-       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")); 
-   
-       // convert the bitmaps to clickable things 
-       ConvertStaticToHyperlink (GetDlgItem (hWnd, BITMAP_ABOUT)); 
-       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 was it the picture ? change the picture and display our face instead :p 
-       else if (wParam_loword == BITMAP_ABOUT) 
-       { 
-          is_authordisplayed ^= true; // alternate author display with about display picture 
-          SendMessage (GetDlgItem (hWnd, BITMAP_ABOUT), STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) LoadBitmap (hAppInstance, MAKEINTRESOURCE (is_authordisplayed ? BITMAP_AUTHOR : BITMAP_ABOUT))); 
-       } 
-   
-       // 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); 
- } 
-