From f594701e3387db38e768b122ec5a93fcf8a3b9d1 Mon Sep 17 00:00:00 2001 From: sje Date: Tue, 21 Nov 2006 22:04:45 +0000 Subject: remember last closed window, not last opened git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@52 4f64403b-2f21-0410-a795-97e2b3489a10 --- last_contact/LastContact.cpp | 23 +++++++++++++---------- last_contact/LastContact.mdsp | 2 +- last_contact/resource.rc | 8 ++++---- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/last_contact/LastContact.cpp b/last_contact/LastContact.cpp index 2432da8..6499ed3 100644 --- a/last_contact/LastContact.cpp +++ b/last_contact/LastContact.cpp @@ -24,7 +24,7 @@ HWND hWndLastContact = 0; PLUGININFO pluginInfo={ sizeof(PLUGININFO), MODULE, - PLUGIN_MAKE_VERSION(0,0,0,2), + PLUGIN_MAKE_VERSION(0,0,0,4), "Re-open the last open message window using a configurable hot key.", "Scott Ellis", "mail@scottellis.com.au", @@ -47,9 +47,13 @@ extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVers void PlaceOnTop(HWND hwnd) { // set window style - LONG ex_style = GetWindowLong(hwnd, GWL_EXSTYLE); - ex_style |= WS_EX_TOPMOST; - SetWindowLong(hwnd, GWL_EXSTYLE, ex_style); + //LONG ex_style = GetWindowLong(hwnd, GWL_EXSTYLE); + //ex_style |= WS_EX_TOPMOST; + //SetWindowLong(hwnd, GWL_EXSTYLE, ex_style); + + SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); + + PostMessage(hwnd, WM_SYSCOMMAND, SC_HOTKEY, (LPARAM)hwnd); if(DBGetContactSettingByte(0, MODULE, "MakeChildFullScreen", 0)) { // make window child of any full-screen topmost windows @@ -87,10 +91,13 @@ int WindowEvent(WPARAM wParam, LPARAM lParam) { switch(ed->uType) { case MSG_WINDOW_EVT_OPENING: - hLastContact = ed->hContact; break; case MSG_WINDOW_EVT_OPEN: - // if there's a full-screen app running, make the window its child + break; + case MSG_WINDOW_EVT_CLOSING: + break; + case MSG_WINDOW_EVT_CLOSE: + hLastContact = ed->hContact; hWndLastContact = ed->hwndWindow; if(options.make_topmost) { HWND hwnd = hWndLastContact, parent = 0; @@ -98,10 +105,6 @@ int WindowEvent(WPARAM wParam, LPARAM lParam) { PlaceOnTop(hwnd); } break; - case MSG_WINDOW_EVT_CLOSING: - case MSG_WINDOW_EVT_CLOSE: - // care factor? - break; } return 0; diff --git a/last_contact/LastContact.mdsp b/last_contact/LastContact.mdsp index fc950a0..240bd64 100644 --- a/last_contact/LastContact.mdsp +++ b/last_contact/LastContact.mdsp @@ -91,4 +91,4 @@ extraResourceOptions= 1=resource.rc [Other] [History] -LastContact.cpp,555 +LastContact.cpp,820 diff --git a/last_contact/resource.rc b/last_contact/resource.rc index cd79237..d480751 100644 --- a/last_contact/resource.rc +++ b/last_contact/resource.rc @@ -30,10 +30,10 @@ IDD_OPT1 DIALOGEX 0, 0, 246, 179 STYLE DS_SETFONT | WS_POPUP FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN - CONTROL "",IDC_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,110,59,80,14 - RTEXT "Hot key:",IDC_STATIC,48,63,55,8 - CONTROL "Hide window if already visible",IDC_CHK_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,77,91,108,10 - CONTROL "Make window topmost",IDC_CHK_ONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,77,108,87,10 + CONTROL "",IDC_HOTKEY,"msctls_hotkey32",WS_BORDER | WS_TABSTOP,104,61,80,14 + RTEXT "Hot key:",IDC_STATIC,42,65,55,8 + CONTROL "Hide window if already visible",IDC_CHK_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,91,148,10 + CONTROL "Place window on top of others",IDC_CHK_ONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,108,148,10 END -- cgit v1.2.3