From 301b66db61ce7434db602b228ffb4f087f29a368 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 12 Oct 2000 12:56:33 +0000 Subject: [PATCH] Implement a much more visually appealing, but much more internally grotty, hack to get around Explorer maximising the config box. git-svn-id: svn://svn.tartarus.org/sgt/putty@707 cda61777-01e9-0310-a592-d414129be87e --- putty.h | 1 + windlg.c | 23 +++++++++++++++++++++++ window.c | 4 ++++ 3 files changed, 28 insertions(+) diff --git a/putty.h b/putty.h index af5b7555..23bf5474 100644 --- a/putty.h +++ b/putty.h @@ -269,6 +269,7 @@ void random_destroy_seed(void); /* * Exports from windlg.c. */ +int defuse_showwindow(void); int do_config (void); int do_reconfig (HWND); void do_defaults (char *, Config *); diff --git a/windlg.c b/windlg.c index e012b3d0..57f49436 100644 --- a/windlg.c +++ b/windlg.c @@ -173,6 +173,14 @@ static int CALLBACK AboutProc (HWND hwnd, UINT msg, return 0; } +/* + * Null dialog procedure. + */ +static int CALLBACK NullDlgProc (HWND hwnd, UINT msg, + WPARAM wParam, LPARAM lParam) { + return 0; +} + /* ---------------------------------------------------------------------- * Routines to self-manage the controls in a dialog box. */ @@ -2297,6 +2305,21 @@ static int CALLBACK ReconfDlgProc (HWND hwnd, UINT msg, return GenericMainDlgProc (hwnd, msg, wParam, lParam, 1); } +int defuse_showwindow(void) { + /* + * Work around the fact that the app's first call to ShowWindow + * will ignore the default in favour of the shell-provided + * setting. + */ + { + HWND hwnd; + hwnd = CreateDialog (hinst, MAKEINTRESOURCE(IDD_ABOUTBOX), + NULL, NullDlgProc); + ShowWindow(hwnd, SW_HIDE); + DestroyWindow(hwnd); + } +} + int do_config (void) { int ret; diff --git a/window.c b/window.c index 410ba1a9..bb436369 100644 --- a/window.c +++ b/window.c @@ -126,6 +126,10 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { InitCommonControls(); + /* Ensure a Maximize setting in Explorer doesn't maximise the + * config box. */ + defuse_showwindow(); + /* * Process the command line. */ -- 2.11.0