*/
ReleaseCapture();
if (dp.ended)
- EndDialog(hwnd, dp.endresult ? 1 : 0);
+ SaneEndDialog(hwnd, dp.endresult ? 1 : 0);
break;
case WM_NOTIFY:
if (LOWORD(wParam) == IDCX_TREEVIEW &&
if (GetWindowLong(hwnd, GWL_USERDATA) == 1) {
ret = winctrl_handle_command(&dp, msg, wParam, lParam);
if (dp.ended && GetCapture() != hwnd)
- EndDialog(hwnd, dp.endresult ? 1 : 0);
+ SaneEndDialog(hwnd, dp.endresult ? 1 : 0);
} else
ret = 0;
return ret;
WinHelp(hwnd, help_path, HELP_QUIT, 0);
requested_help = FALSE;
}
- EndDialog(hwnd, 0);
+ SaneEndDialog(hwnd, 0);
return 0;
/* Grrr Explorer will maximize Dialogs! */
get_sesslist(&sesslist, TRUE);
ret =
- DialogBox(hinst, MAKEINTRESOURCE(IDD_MAINBOX), NULL,
+ SaneDialogBox(hinst, MAKEINTRESOURCE(IDD_MAINBOX), NULL,
GenericMainDlgProc);
get_sesslist(&sesslist, FALSE);
dp.data = &cfg;
dp.shortcuts['g'] = TRUE; /* the treeview: `Cate&gory' */
- ret =
- DialogBox(hinst, MAKEINTRESOURCE(IDD_MAINBOX), NULL,
+ ret = SaneDialogBox(hinst, MAKEINTRESOURCE(IDD_MAINBOX), NULL,
GenericMainDlgProc);
ctrl_free_box(ctrlbox);
#include <stdio.h>
#include <stdlib.h>
#include "putty.h"
+#include "winstuff.h"
void platform_get_x11_auth(char *display, int *proto,
unsigned char *data, int *datalen)
return !*fn.path;
}
+int SaneDialogBox(HINSTANCE hinst,
+ LPCTSTR tmpl,
+ HWND hwndparent,
+ DLGPROC lpDialogFunc)
+{
+ HWND boxhwnd;
+ MSG msg;
+
+ boxhwnd = CreateDialog(hinst, tmpl, hwndparent, lpDialogFunc);
+ while (GetMessage(&msg, NULL, 0, 0)) {
+ if (!(boxinfo.flags & DF_END) && !IsDialogMessage(boxhwnd, &msg))
+ DispatchMessage(&msg);
+ if (boxinfo.flags & DF_END) break;
+ }
+ boxinfo.flags=0;
+ return boxinfo.result;
+}
+
+void SaneEndDialog(HWND hwnd, int ret)
+{
+ boxinfo.result = ret;
+ boxinfo.flags |= DF_END;
+ DestroyWindow(hwnd);
+}
+
#ifdef DEBUG
static FILE *debug_fp = NULL;
static HANDLE debug_hdl = INVALID_HANDLE_VALUE;
int charset;
};
+struct dlgboxinfo {
+ int result;
+ int flags;
+};
+
+#define DF_END 0x0001
+
/*
* Global variables. Most modules declare these `extern', but
* window.c will do `#define PUTTY_DO_GLOBALS' before including this
GLOBAL HWND logbox;
/*
+ * Global structure to hold return values from the config box.
+ */
+GLOBAL struct dlgboxinfo boxinfo;
+
+/*
* The all-important instance handle.
*/
GLOBAL HINSTANCE hinst;
void show_help(HWND hwnd);
/*
+ * Exports from winmisc.c.
+ */
+
+int SaneDialogBox(HINSTANCE hinst,
+ LPCTSTR tmpl,
+ HWND hwndparent,
+ DLGPROC lpDialogFunc);
+
+void SaneEndDialog(HWND hwnd, int ret);
+
+/*
* Exports from sizetip.c.
*/
void UpdateSizeTip(HWND src, int cx, int cy);