mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 09:58:01 +00:00
Make SaneDialogBox and SaneEndDialog use [GS]etWindowLong rather than
a global variable. Should mean that pageant builds. [originally from svn r3274]
This commit is contained in:
parent
27d54e8f96
commit
a5ffab338d
@ -47,6 +47,7 @@ IDD_MAINBOX DIALOG DISCARDABLE 0, 0, 280, 252
|
|||||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
CAPTION "PuTTY Configuration"
|
CAPTION "PuTTY Configuration"
|
||||||
FONT 8, "MS Shell Dlg"
|
FONT 8, "MS Shell Dlg"
|
||||||
|
CLASS "PuTTYConfigBox"
|
||||||
BEGIN
|
BEGIN
|
||||||
END
|
END
|
||||||
|
|
||||||
|
40
winmisc.c
40
winmisc.c
@ -42,24 +42,46 @@ int SaneDialogBox(HINSTANCE hinst,
|
|||||||
HWND hwndparent,
|
HWND hwndparent,
|
||||||
DLGPROC lpDialogFunc)
|
DLGPROC lpDialogFunc)
|
||||||
{
|
{
|
||||||
HWND boxhwnd;
|
WNDCLASS wc;
|
||||||
|
HWND hwnd;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
int flags;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW;
|
||||||
|
wc.lpfnWndProc = DefDlgProc;
|
||||||
|
wc.cbClsExtra = 0;
|
||||||
|
wc.cbWndExtra = DLGWINDOWEXTRA + 8;
|
||||||
|
wc.hInstance = hinst;
|
||||||
|
wc.hIcon = NULL;
|
||||||
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
|
wc.hbrBackground = (HBRUSH) (COLOR_BACKGROUND +1);
|
||||||
|
wc.lpszMenuName = NULL;
|
||||||
|
wc.lpszClassName = "PuTTYConfigBox";
|
||||||
|
RegisterClass(&wc);
|
||||||
|
|
||||||
|
hwnd = CreateDialog(hinst, tmpl, hwndparent, lpDialogFunc);
|
||||||
|
|
||||||
|
SetWindowLong(hwnd, BOXFLAGS, 0); /* flags */
|
||||||
|
SetWindowLong(hwnd, BOXRESULT, 0); /* result from SaneEndDialog */
|
||||||
|
|
||||||
boxhwnd = CreateDialog(hinst, tmpl, hwndparent, lpDialogFunc);
|
|
||||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||||
if (!(boxinfo.flags & DF_END) && !IsDialogMessage(boxhwnd, &msg))
|
flags=GetWindowLong(hwnd, BOXFLAGS);
|
||||||
|
if (!(flags & DF_END) && !IsDialogMessage(hwnd, &msg))
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
if (boxinfo.flags & DF_END) break;
|
if (flags & DF_END)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
boxinfo.flags=0;
|
|
||||||
return boxinfo.result;
|
ret=GetWindowLong(hwnd, BOXRESULT);
|
||||||
|
DestroyWindow(hwnd);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaneEndDialog(HWND hwnd, int ret)
|
void SaneEndDialog(HWND hwnd, int ret)
|
||||||
{
|
{
|
||||||
boxinfo.result = ret;
|
SetWindowLong(hwnd, BOXRESULT, ret);
|
||||||
boxinfo.flags |= DF_END;
|
SetWindowLong(hwnd, BOXFLAGS, DF_END);
|
||||||
DestroyWindow(hwnd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
12
winstuff.h
12
winstuff.h
@ -23,11 +23,8 @@ struct FontSpec {
|
|||||||
int charset;
|
int charset;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dlgboxinfo {
|
#define BOXFLAGS DLGWINDOWEXTRA
|
||||||
int result;
|
#define BOXRESULT DLGWINDOWEXTRA + 4
|
||||||
int flags;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define DF_END 0x0001
|
#define DF_END 0x0001
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -70,11 +67,6 @@ typedef HDC Context;
|
|||||||
*/
|
*/
|
||||||
GLOBAL HWND logbox;
|
GLOBAL HWND logbox;
|
||||||
|
|
||||||
/*
|
|
||||||
* Global structure to hold return values from the config box.
|
|
||||||
*/
|
|
||||||
GLOBAL struct dlgboxinfo boxinfo;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The all-important instance handle.
|
* The all-important instance handle.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user