diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index ee411922..3c64bfe6 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -20,7 +20,6 @@ #include #include "ScintillaEditView.h" #include "Parameters.h" -//#include "constant.h" // initialize the static variable diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp index 5a3eb489..c9b5a869 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp @@ -24,7 +24,7 @@ #include "WindowInterface.h" #include "ToolTip.h" #include -//#include +#include "Parameters.h" #include "Common.h" #ifndef WH_MOUSE_LL @@ -290,14 +290,8 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR // start hooking hWndServer = _hCaption; - if (GetVersion() & 0x80000000) - { - hookMouse = ::SetWindowsHookEx(WH_MOUSE, (HOOKPROC)hookProcMouse, _hInst, GetCurrentThreadId()); - } - else - { - hookMouse = ::SetWindowsHookEx(WH_MOUSE_LL, (HOOKPROC)hookProcMouse, _hInst, GetCurrentThreadId()); - } + winVer ver = (NppParameters::getInstance())->getWinVersion(); + hookMouse = ::SetWindowsHookEx(ver >= WV_W2K?WH_MOUSE_LL:WH_MOUSE, (HOOKPROC)hookProcMouse, _hInst, 0); if (!hookMouse) { diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp index b14ed025..4311ffc8 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp @@ -141,7 +141,7 @@ void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin) hWndServer = _hSelf; CoInitialize(NULL); if (!gWinCallHook) //only set if not already done - gWinCallHook = SetWindowsHookEx(WH_CALLWNDPROC, FocusWndProc, NULL, GetCurrentThreadId()); + gWinCallHook = SetWindowsHookEx(WH_CALLWNDPROC, FocusWndProc, hInst, GetCurrentThreadId()); if (!gWinCallHook) { diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.cpp index c7349732..c93d0153 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingSplitter.cpp @@ -18,6 +18,8 @@ #include "DockingSplitter.h" #include "Common.h" +#include "Notepad_plus_msgs.h" +#include "Parameters.h" BOOL DockingSplitter::_isVertReg = FALSE; BOOL DockingSplitter::_isHoriReg = FALSE; @@ -141,14 +143,9 @@ LRESULT DockingSplitter::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM { hWndMouse = hwnd; - if (GetVersion() & 0x80000000) - { - hookMouse = ::SetWindowsHookEx(WH_MOUSE, (HOOKPROC)hookProcMouse, _hInst, GetCurrentThreadId()); - } - else - { - hookMouse = ::SetWindowsHookEx(WH_MOUSE_LL, (HOOKPROC)hookProcMouse, _hInst, GetCurrentThreadId()); - } + winVer ver = (NppParameters::getInstance())->getWinVersion(); + hookMouse = ::SetWindowsHookEx(ver >= WV_W2K?WH_MOUSE_LL:WH_MOUSE, (HOOKPROC)hookProcMouse, _hInst, 0); + if (!hookMouse) { diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp index d32647d5..214b8088 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp @@ -252,18 +252,11 @@ void Gripper::create(void) RECT rc = {0}; POINT pt = {0}; - /* start hooking */ + // start hooking ::SetWindowPos(_pCont->getHSelf(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); ::SetCapture(_hSelf); - - if (GetVersion() & 0x80000000) - { - hookMouse = ::SetWindowsHookEx(WH_MOUSE, (HOOKPROC)hookProcMouse, _hInst, GetCurrentThreadId()); - } - else - { - hookMouse = ::SetWindowsHookEx(WH_MOUSE_LL, (HOOKPROC)hookProcMouse, _hInst, GetCurrentThreadId()); - } + winVer ver = (NppParameters::getInstance())->getWinVersion(); + hookMouse = ::SetWindowsHookEx(ver >= WV_W2K?WH_MOUSE_LL:WH_MOUSE, (HOOKPROC)hookProcMouse, _hInst, 0); if (!hookMouse) { @@ -273,25 +266,24 @@ void Gripper::create(void) ::MessageBox(NULL, str, TEXT("SetWindowsHookEx(MOUSE) failed"), MB_OK | MB_ICONERROR); } - winVer winVersion = (NppParameters::getInstance())->getWinVersion(); - if (winVersion < WV_VISTA) + if (ver < WV_VISTA) { - hookKeyboard = ::SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)hookProcKeyboard, _hInst, GetCurrentThreadId()); - if (!hookKeyboard) - { - DWORD dwError = ::GetLastError(); - TCHAR str[128]; - ::wsprintf(str, TEXT("GetLastError() returned %lu"), dwError); - ::MessageBox(NULL, str, TEXT("SetWindowsHookEx(KEYBOARD) failed"), MB_OK | MB_ICONERROR); - } + hookKeyboard = ::SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)hookProcKeyboard, _hInst, 0); + if (!hookKeyboard) + { + DWORD dwError = ::GetLastError(); + TCHAR str[128]; + ::wsprintf(str, TEXT("GetLastError() returned %lu"), dwError); + ::MessageBox(NULL, str, TEXT("SetWindowsHookEx(KEYBOARD) failed"), MB_OK | MB_ICONERROR); + } } // Removed regarding W9x systems // mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); - /* calculate the mouse pt within dialog */ + // calculate the mouse pt within dialog ::GetCursorPos(&pt); - /* get tab informations */ + // get tab informations initTabInformation(pt); if (_pCont->isFloating() == true) diff --git a/PowerEditor/src/WinControls/TaskList/TaskListDlg.h b/PowerEditor/src/WinControls/TaskList/TaskListDlg.h index 106bf2e1..d1d93bd0 100644 --- a/PowerEditor/src/WinControls/TaskList/TaskListDlg.h +++ b/PowerEditor/src/WinControls/TaskList/TaskListDlg.h @@ -113,7 +113,7 @@ protected : #define WH_MOUSE_LL 14 #endif winVer ver = (NppParameters::getInstance())->getWinVersion(); - _hHooker = ::SetWindowsHookEx(ver >= WV_W2K?WH_MOUSE_LL:WH_MOUSE, (HOOKPROC)hookProc, _hInst, GetCurrentThreadId()); + _hHooker = ::SetWindowsHookEx(ver >= WV_W2K?WH_MOUSE_LL:WH_MOUSE, (HOOKPROC)hookProc, _hInst, 0); hook = _hHooker; return FALSE; }