From 48b4416cd73a0a6ff5cd83e448d4eab11b200224 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 24 Apr 2015 14:20:47 +0000 Subject: CDlgBase::Find() - useful helper for searching window classes git-svn-id: http://svn.miranda-ng.org/main/trunk@13086 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/src/mir_core.def | 1 + src/mir_core/src/mir_core64.def | 1 + src/mir_core/src/ui_utils.cpp | 17 +++++++++-------- 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/mir_core') diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 6935548cb0..464ba16984 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1074,3 +1074,4 @@ ProtoWindowRemove @1072 NONAME Proto_IsProtocolLoaded @1073 NONAME Proto_RegisterModule @1074 NONAME ?GetInst@CDlgBase@@QBEPAUHINSTANCE__@@XZ @1075 NONAME +?Find@CDlgBase@@SAPAV1@PAUHWND__@@@Z @1076 NONAME diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 1e5e35b29c..8ded9a75f0 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1075,3 +1075,4 @@ Proto_IsProtocolLoaded @1073 NONAME Proto_RegisterModule @1074 NONAME ?GetInst@CDlgBase@@QEBAPEAUHINSTANCE__@@XZ @1075 NONAME +?Find@CDlgBase@@SAPEAV1@PEAUHWND__@@@Z @1076 NONAME diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp index 5765d533b3..1148ab247a 100644 --- a/src/mir_core/src/ui_utils.cpp +++ b/src/mir_core/src/ui_utils.cpp @@ -220,20 +220,14 @@ INT_PTR CALLBACK CDlgBase::GlobalDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA mir_cslock lck(csDialogs); arDialogs.insert(wnd); } - else { - PVOID bullshit[2]; // vfptr + hwnd - bullshit[1] = hwnd; - wnd = arDialogs.find((CDlgBase*)&bullshit); - } + else wnd = CDlgBase::Find(hwnd); return (wnd == NULL) ? FALSE : wnd->DlgProc(msg, wParam, lParam); } int CDlgBase::GlobalDlgResizer(HWND hwnd, LPARAM, UTILRESIZECONTROL *urc) { - PVOID bullshit[2]; // vfptr + hwnd - bullshit[1] = hwnd; - CDlgBase *wnd = arDialogs.find((CDlgBase*)&bullshit); + CDlgBase *wnd = wnd = CDlgBase::Find(hwnd); return (wnd == NULL) ? 0 : wnd->Resizer(urc); } @@ -259,6 +253,13 @@ CCtrlBase* CDlgBase::FindControl(int idCtrl) return m_controls.find(&search); } +CDlgBase* CDlgBase::Find(HWND hwnd) +{ + PVOID bullshit[2]; // vfptr + hwnd + bullshit[1] = hwnd; + return arDialogs.find((CDlgBase*)&bullshit); +} + ///////////////////////////////////////////////////////////////////////////////////////// // CCtrlCombo class -- cgit v1.2.3