X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/3ac9cd9f913cd762475a710a2ae2163b74a55c46..d8770b1245ff0acd81f581c5667563e0d127104a:/windlg.c diff --git a/windlg.c b/windlg.c index 737305df..9b2e60fb 100644 --- a/windlg.c +++ b/windlg.c @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include "ssh.h" #include "putty.h" @@ -13,8 +15,6 @@ static char **events = NULL; static int nevents = 0, negsize = 0; -static HWND logbox = NULL, abtbox = NULL; - static int readytogo; void force_normal(HWND hwnd) @@ -49,6 +49,11 @@ static int CALLBACK LogProc (HWND hwnd, UINT msg, switch (msg) { case WM_INITDIALOG: + { + static int tabs[4] = {78, 108}; + SendDlgItemMessage (hwnd, IDN_LIST, LB_SETTABSTOPS, 2, + (LPARAM) tabs); + } for (i=0; i= negsize) { negsize += 64; events = srealloc (events, negsize * sizeof(*events)); } - events[nevents] = smalloc(1+strlen(string)); - strcpy (events[nevents], string); - nevents++; + + time(&t); + strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S\t", localtime(&t)); + + events[nevents] = smalloc(strlen(timebuf)+strlen(string)+1); + strcpy(events[nevents], timebuf); + strcat(events[nevents], string); if (logbox) { int count; SendDlgItemMessage (logbox, IDN_LIST, LB_ADDSTRING, - 0, (LPARAM)string); + 0, (LPARAM)events[nevents]); count = SendDlgItemMessage (logbox, IDN_LIST, LB_GETCOUNT, 0, 0); SendDlgItemMessage (logbox, IDN_LIST, LB_SETTOPINDEX, count-1, 0); } + nevents++; } void showeventlog (HWND hwnd) { @@ -1992,14 +2081,11 @@ void showeventlog (HWND hwnd) { hwnd, LogProc); ShowWindow (logbox, SW_SHOWNORMAL); } + SetActiveWindow(logbox); } void showabout (HWND hwnd) { - if (!abtbox) { - abtbox = CreateDialog (hinst, MAKEINTRESOURCE(IDD_ABOUTBOX), - hwnd, AboutProc); - ShowWindow (abtbox, SW_SHOWNORMAL); - } + DialogBox(hinst, MAKEINTRESOURCE(IDD_ABOUTBOX),hwnd, AboutProc); } void verify_ssh_host_key(char *host, int port, char *keytype,