[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 "ScintillaEditView.h"
#include "Parameters.h"
//#include "constant.h"
// initialize the static variable

View File

@ -24,7 +24,7 @@
#include "WindowInterface.h"
#include "ToolTip.h"
#include <Commctrl.h>
//#include <shlobj.h>
#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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)

View File

@ -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;
}