Subversion Repositories Games.Chess Giants

Rev

Rev 124 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 1
// dialog_messagebox.cpp
2
 
3
#include "../common.h"
4
 
5
 
6
// prototypes of local functions
7
static void StartThread_ThisDialog (void *thread_parms);
8
 
9
 
10
void DialogBox_Message (messagebox_t *messagebox_parms)
11
{
12
   // helper function to fire up the modeless dialog box
13
 
14
   _beginthread (StartThread_ThisDialog, 0, (void *) messagebox_parms); // fire up the thread
15
   return; // return as soon as the thread is fired up
16
}
17
 
18
 
19
void DialogBox_Message_Validated (void)
20
{
21
   // callback function called by the main game thread when the dialog box is validated
22
 
23
   // remember this callback is no longer to be called
24
   is_dialogbox_message_validated = false;
25
 
26
   return; // finished
27
}
28
 
29
 
30
static void StartThread_ThisDialog (void *thread_parms)
31
{
32
   // this function runs in a separate thread, for that's the only way (seemingly)
33
   // to implement a non-modal message box using the Common Controls library.
34
 
35
   messagebox_t *mb;
36
 
37
   mb = (messagebox_t *) thread_parms; // quick access to message box structure
38
 
39
   // display the message box and wait for it to return
40
   MessageBox (IsWindow (mb->hWndParent) ? mb->hWndParent : (IsWindow (hMainWnd) ? hMainWnd : NULL), mb->text, mb->title, mb->flags);
41
   is_dialogbox_message_validated = true;
42
 
43
   return; // _endthread() implied
44
}