From 24a39515399e9555dd0e4ad72b7a22f9152b0adf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 19 May 2015 12:50:25 +0000 Subject: end of zoo with WM_CONTEXTMENU's lParam git-svn-id: http://svn.miranda-ng.org/main/trunk@13693 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CrashDumper/src/stdafx.h | 1 + plugins/CrashDumper/src/ui.cpp | 82 ++++++++++++++++++++-------------------- 2 files changed, 41 insertions(+), 42 deletions(-) (limited to 'plugins/CrashDumper/src') diff --git a/plugins/CrashDumper/src/stdafx.h b/plugins/CrashDumper/src/stdafx.h index ff77ceff81..a99afa3317 100644 --- a/plugins/CrashDumper/src/stdafx.h +++ b/plugins/CrashDumper/src/stdafx.h @@ -17,6 +17,7 @@ along with this program. If not, see . */ #include +#include #include #include diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 7050771388..b96870a9ea 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -102,12 +102,12 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case WM_GETMINMAXINFO: - { - LPMINMAXINFO mmi = (LPMINMAXINFO)lParam; - mmi->ptMinTrackSize.x = 400; // The minimum width in points - mmi->ptMinTrackSize.y = 300; // The minimum height in points - } - break; + { + LPMINMAXINFO mmi = (LPMINMAXINFO)lParam; + mmi->ptMinTrackSize.x = 400; // The minimum width in points + mmi->ptMinTrackSize.y = 300; // The minimum height in points + } + break; case WM_COMMAND: switch (LOWORD(wParam)) { @@ -126,44 +126,42 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case WM_CONTEXTMENU: - { - HWND hView = GetDlgItem(hwndDlg, IDC_VIEWVERSIONINFO); - GetWindowRect(hView, &rc); - - POINT pt; - pt.x = LOWORD(lParam); - pt.y = HIWORD(lParam); - if (PtInRect(&rc, pt)) { - static const CHARRANGE all = { 0, -1 }; - - HMENU hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT)); - HMENU hSubMenu = GetSubMenu(hMenu, 0); - TranslateMenu(hSubMenu); - - CHARRANGE sel; - SendMessage(hView, EM_EXGETSEL, 0, (LPARAM)&sel); - if (sel.cpMin == sel.cpMax) - EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); - - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) { - case IDM_COPY: - SendMessage(hView, WM_COPY, 0, 0); - break; - - case IDM_COPYALL: - SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&all); - SendMessage(hView, WM_COPY, 0, 0); - SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&sel); - break; - - case IDM_SELECTALL: - SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&all); - break; + { + HWND hView = GetDlgItem(hwndDlg, IDC_VIEWVERSIONINFO); + GetWindowRect(hView, &rc); + + POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; + if (PtInRect(&rc, pt)) { + static const CHARRANGE all = { 0, -1 }; + + HMENU hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT)); + HMENU hSubMenu = GetSubMenu(hMenu, 0); + TranslateMenu(hSubMenu); + + CHARRANGE sel; + SendMessage(hView, EM_EXGETSEL, 0, (LPARAM)&sel); + if (sel.cpMin == sel.cpMax) + EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); + + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) { + case IDM_COPY: + SendMessage(hView, WM_COPY, 0, 0); + break; + + case IDM_COPYALL: + SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&all); + SendMessage(hView, WM_COPY, 0, 0); + SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&sel); + break; + + case IDM_SELECTALL: + SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&all); + break; + } + DestroyMenu(hMenu); } - DestroyMenu(hMenu); } - } - break; + break; case WM_DESTROY: hViewWnd = NULL; -- cgit v1.2.3