[RESET] restore SetWindowsHookEx parameter values.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@447 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2009-04-07 00:33:00 +00:00
parent 91b9b03ff7
commit defd2ae4e0
6 changed files with 24 additions and 42 deletions

View File

@ -20,7 +20,6 @@
#include <ShellAPI.h> #include <ShellAPI.h>
#include "ScintillaEditView.h" #include "ScintillaEditView.h"
#include "Parameters.h" #include "Parameters.h"
//#include "constant.h"
// initialize the static variable // initialize the static variable

View File

@ -24,7 +24,7 @@
#include "WindowInterface.h" #include "WindowInterface.h"
#include "ToolTip.h" #include "ToolTip.h"
#include <Commctrl.h> #include <Commctrl.h>
//#include <shlobj.h> #include "Parameters.h"
#include "Common.h" #include "Common.h"
#ifndef WH_MOUSE_LL #ifndef WH_MOUSE_LL
@ -290,14 +290,8 @@ LRESULT DockingCont::runProcCaption(HWND hwnd, UINT Message, WPARAM wParam, LPAR
// start hooking // start hooking
hWndServer = _hCaption; hWndServer = _hCaption;
if (GetVersion() & 0x80000000) winVer ver = (NppParameters::getInstance())->getWinVersion();
{ hookMouse = ::SetWindowsHookEx(ver >= WV_W2K?WH_MOUSE_LL:WH_MOUSE, (HOOKPROC)hookProcMouse, _hInst, 0);
hookMouse = ::SetWindowsHookEx(WH_MOUSE, (HOOKPROC)hookProcMouse, _hInst, GetCurrentThreadId());
}
else
{
hookMouse = ::SetWindowsHookEx(WH_MOUSE_LL, (HOOKPROC)hookProcMouse, _hInst, GetCurrentThreadId());
}
if (!hookMouse) if (!hookMouse)
{ {

View File

@ -141,7 +141,7 @@ void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin)
hWndServer = _hSelf; hWndServer = _hSelf;
CoInitialize(NULL); CoInitialize(NULL);
if (!gWinCallHook) //only set if not already done if (!gWinCallHook) //only set if not already done
gWinCallHook = SetWindowsHookEx(WH_CALLWNDPROC, FocusWndProc, NULL, GetCurrentThreadId()); gWinCallHook = SetWindowsHookEx(WH_CALLWNDPROC, FocusWndProc, hInst, GetCurrentThreadId());
if (!gWinCallHook) if (!gWinCallHook)
{ {

View File

@ -18,6 +18,8 @@
#include "DockingSplitter.h" #include "DockingSplitter.h"
#include "Common.h" #include "Common.h"
#include "Notepad_plus_msgs.h"
#include "Parameters.h"
BOOL DockingSplitter::_isVertReg = FALSE; BOOL DockingSplitter::_isVertReg = FALSE;
BOOL DockingSplitter::_isHoriReg = FALSE; BOOL DockingSplitter::_isHoriReg = FALSE;
@ -141,14 +143,9 @@ LRESULT DockingSplitter::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
{ {
hWndMouse = hwnd; hWndMouse = hwnd;
if (GetVersion() & 0x80000000) winVer ver = (NppParameters::getInstance())->getWinVersion();
{ hookMouse = ::SetWindowsHookEx(ver >= WV_W2K?WH_MOUSE_LL:WH_MOUSE, (HOOKPROC)hookProcMouse, _hInst, 0);
hookMouse = ::SetWindowsHookEx(WH_MOUSE, (HOOKPROC)hookProcMouse, _hInst, GetCurrentThreadId());
}
else
{
hookMouse = ::SetWindowsHookEx(WH_MOUSE_LL, (HOOKPROC)hookProcMouse, _hInst, GetCurrentThreadId());
}
if (!hookMouse) if (!hookMouse)
{ {

View File

@ -252,18 +252,11 @@ void Gripper::create(void)
RECT rc = {0}; RECT rc = {0};
POINT pt = {0}; POINT pt = {0};
/* start hooking */ // start hooking
::SetWindowPos(_pCont->getHSelf(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); ::SetWindowPos(_pCont->getHSelf(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
::SetCapture(_hSelf); ::SetCapture(_hSelf);
winVer ver = (NppParameters::getInstance())->getWinVersion();
if (GetVersion() & 0x80000000) hookMouse = ::SetWindowsHookEx(ver >= WV_W2K?WH_MOUSE_LL:WH_MOUSE, (HOOKPROC)hookProcMouse, _hInst, 0);
{
hookMouse = ::SetWindowsHookEx(WH_MOUSE, (HOOKPROC)hookProcMouse, _hInst, GetCurrentThreadId());
}
else
{
hookMouse = ::SetWindowsHookEx(WH_MOUSE_LL, (HOOKPROC)hookProcMouse, _hInst, GetCurrentThreadId());
}
if (!hookMouse) if (!hookMouse)
{ {
@ -273,10 +266,9 @@ void Gripper::create(void)
::MessageBox(NULL, str, TEXT("SetWindowsHookEx(MOUSE) failed"), MB_OK | MB_ICONERROR); ::MessageBox(NULL, str, TEXT("SetWindowsHookEx(MOUSE) failed"), MB_OK | MB_ICONERROR);
} }
winVer winVersion = (NppParameters::getInstance())->getWinVersion(); if (ver < WV_VISTA)
if (winVersion < WV_VISTA)
{ {
hookKeyboard = ::SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)hookProcKeyboard, _hInst, GetCurrentThreadId()); hookKeyboard = ::SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)hookProcKeyboard, _hInst, 0);
if (!hookKeyboard) if (!hookKeyboard)
{ {
DWORD dwError = ::GetLastError(); DWORD dwError = ::GetLastError();
@ -288,10 +280,10 @@ void Gripper::create(void)
// Removed regarding W9x systems // Removed regarding W9x systems
// mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); // mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
/* calculate the mouse pt within dialog */ // calculate the mouse pt within dialog
::GetCursorPos(&pt); ::GetCursorPos(&pt);
/* get tab informations */ // get tab informations
initTabInformation(pt); initTabInformation(pt);
if (_pCont->isFloating() == true) if (_pCont->isFloating() == true)

View File

@ -113,7 +113,7 @@ protected :
#define WH_MOUSE_LL 14 #define WH_MOUSE_LL 14
#endif #endif
winVer ver = (NppParameters::getInstance())->getWinVersion(); 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; hook = _hHooker;
return FALSE; return FALSE;
} }