X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/979310f11573a32bd1b4aff8e39e90e18787e144..9ad90448c75dfbf85f25b7587f2352157d1a190a:/windlg.c diff --git a/windlg.c b/windlg.c index 41951f97..6967f4be 100644 --- a/windlg.c +++ b/windlg.c @@ -1,7 +1,13 @@ #include #include #include +#ifndef AUTO_WINSOCK +#ifdef WINSOCK_TWO +#include +#else #include +#endif +#endif #include #include @@ -478,6 +484,7 @@ static int CALLBACK AboutProc (HWND hwnd, UINT msg, DialogBox (hinst, MAKEINTRESOURCE(IDD_LICENCEBOX), NULL, LicenceProc); EnableWindow(hwnd, 1); + SetActiveWindow(hwnd); return 0; } return 0; @@ -508,6 +515,8 @@ static int GeneralPanelProc (HWND hwnd, UINT msg, return 0; } +static char savedsession[2048]; + static int CALLBACK ConnectionProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { int i; @@ -515,6 +524,7 @@ static int CALLBACK ConnectionProc (HWND hwnd, UINT msg, switch (msg) { case WM_INITDIALOG: SetDlgItemText (hwnd, IDC0_HOST, cfg.host); + SetDlgItemText (hwnd, IDC0_SESSEDIT, savedsession); SetDlgItemInt (hwnd, IDC0_PORT, cfg.port, FALSE); for (i = 0; i < nsessions; i++) SendDlgItemMessage (hwnd, IDC0_SESSLIST, LB_ADDSTRING, @@ -571,9 +581,13 @@ static int CALLBACK ConnectionProc (HWND hwnd, UINT msg, cfg.warn_on_close = IsDlgButtonChecked (hwnd, IDC0_CLOSEWARN); break; case IDC0_SESSEDIT: - if (HIWORD(wParam) == EN_CHANGE) + if (HIWORD(wParam) == EN_CHANGE) { SendDlgItemMessage (hwnd, IDC0_SESSLIST, LB_SETCURSEL, (WPARAM) -1, 0); + GetDlgItemText (hwnd, IDC0_SESSEDIT, + savedsession, sizeof(savedsession)-1); + savedsession[sizeof(savedsession)-1] = '\0'; + } break; case IDC0_SESSSAVE: if (HIWORD(wParam) == BN_CLICKED || @@ -1460,6 +1474,7 @@ static int CALLBACK MainDlgProc (HWND hwnd, UINT msg, DialogBox(hinst, MAKEINTRESOURCE(IDD_ABOUTBOX), GetParent(hwnd), AboutProc); EnableWindow(hwnd, 1); + SetActiveWindow(hwnd); } return GenericMainDlgProc (hwnd, msg, wParam, lParam, MAIN_NPANELS, mainp, &page); @@ -1528,6 +1543,7 @@ int do_config (void) { int ret; get_sesslist(TRUE); + savedsession[0] = '\0'; ret = DialogBox (hinst, MAKEINTRESOURCE(IDD_MAINBOX), NULL, MainDlgProc); get_sesslist(FALSE); @@ -1563,9 +1579,13 @@ void logevent (char *string) { events[nevents] = smalloc(1+strlen(string)); strcpy (events[nevents], string); nevents++; - if (logbox) + if (logbox) { + int count; SendDlgItemMessage (logbox, IDN_LIST, LB_ADDSTRING, 0, (LPARAM)string); + count = SendDlgItemMessage (logbox, IDN_LIST, LB_GETCOUNT, 0, 0); + SendDlgItemMessage (logbox, IDN_LIST, LB_SETCURSEL, count-1, 0); + } } void showeventlog (HWND hwnd) {