2 @Copyright Looking Glass Studios, Inc.
3 1996,1997,1998,1999,2000 Unpublished Work.
6 ////////////////////////////////////////////////////////////////////////
8 // (c) 1998 Looking Glass Technologies Inc.
11 // Description: Routines which deal with putting up the opening
12 // dialog warning message. As a famous writer once said, much ado about
14 ////////////////////////////////////////////////////////////////////////
24 #include <dbmem.h> // must be last header!
26 bool bNeverAgainSelected
;
30 // the dialog callback routine
31 BOOL CALLBACK
GameEntryDialogProc(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM
/* lParam */)
36 DWORD dwKeyBufferSize
=sizeof(BOOL
);
42 SetWindowLong(hwndDlg
, GWL_STYLE
, 0x04);
44 GetWindowRect(hwndDlg
, &rcDlg
);
45 GetWindowRect(GetDesktopWindow(), &rcWnd
);
46 int iWndCenterX
= rcWnd
.right
/2, iWndCenterY
= rcWnd
.bottom
/2;
47 int iWidthWindow
= rcDlg
.right
- rcDlg
.left
,
48 iHeightWindow
= rcDlg
.bottom
- rcDlg
.top
;
49 int iNewX
= iWndCenterX
- (iWidthWindow
/2),
50 iNewY
= ((iWndCenterY
- (iHeightWindow
/2)) * 66) / 100;
51 MoveWindow(hwndDlg
, iNewX
, iNewY
, iWidthWindow
, iHeightWindow
, TRUE
);
52 // get the text out of the LG resource system
53 cStr key_str
= FetchUIString("misc","driver_text");
54 cStr never_str
= FetchUIString("misc","neveragain");
56 SetWindowText(GetDlgItem(hwndDlg
,IDC_DXINFO
),(const char*)key_str
);
57 SetWindowText(GetDlgItem(hwndDlg
,IDC_NEVERAGAIN
),(const char *)never_str
);
62 unsigned wNotifyCode
= HIWORD(wParam
); // notification code
63 unsigned wID
= LOWORD(wParam
);
64 unsigned wCheckedOrNot
;
67 case IDOK
: // dialog box OK
68 if (bNeverAgainSelected
) // button was checked
70 // going to have to get the app keys out
71 // of the resource system
72 cStr key_str
= FetchUIString("misc","regkey");
74 retCode
= RegOpenKeyEx (HKEY_LOCAL_MACHINE
,
75 (const char *)key_str
,
80 if(retCode
==ERROR_SUCCESS
) // oxymoron
82 retCode
= RegSetValueEx( // subkey
84 "NeverAgain", // same in every language
90 } // opened successfully
92 } // bNeverAgainSelected
93 EndDialog(hwndDlg
, 0);
97 IsDlgButtonChecked(hwndDlg
,
99 if (wCheckedOrNot
==BST_CHECKED
) {
100 bNeverAgainSelected
=TRUE
;
103 bNeverAgainSelected
=FALSE
;
106 EndDialog(hwndDlg
, 0);
116 // Display 'Please shut down.... ' message
122 HINSTANCE hInst
; // the instance of this exe
126 DWORD dwKeyBufferSize
=sizeof(int);
127 int NeverAgain
=FALSE
;
129 // open the main key (which had better be there!)
130 // get the key from the resource system
131 cStr key_str
= FetchUIString("misc","regkey");
132 retCode
= RegOpenKeyEx (HKEY_LOCAL_MACHINE
,
133 (const char *)key_str
,
138 if(retCode
==ERROR_SUCCESS
) { // oxymoron
139 retCode
= RegQueryValueEx(
143 NULL
, // I don't care about it's type
144 (unsigned char *) &NeverAgain
, // address of data buffer
145 &dwKeyBufferSize
); // address of data buffer size
147 RegCloseKey(hKey
); // we are done either way
149 // we only display the warning if NeverAgain is TRUE and we can
150 // find the dialog. Developers don't usually link in the .res.
152 if (retCode
==ERROR_SUCCESS
)
157 hInst
= GetModuleHandle(NULL
);
158 if ( FindResource(hInst
, MAKEINTRESOURCE(IDD_DXWARNDIALOG
),
161 DialogBox(hInst
, MAKEINTRESOURCE(IDD_DXWARNDIALOG
),
162 GetDesktopWindow(), (DLGPROC
)GameEntryDialogProc
);