点击这里给我发消息 点击这里给我发消息

VC6.0控制鼠标反方向移动

添加时间:2013-12-7
    相关阅读: Windows DW VC

 dll代码:

#define _WIN32_WINNT 0x400
#include <windows.h>
#pragma data_seg("Shared")
HHOOK NextHook = NULL;
SIZE Screen = {0, 0};
POINT pt = {0, 0};
#pragma data_seg()
HMODULE Module;
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
Module = hModule;
return TRUE;
}
LRESULT CALLBACK LowLevelMouseProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if (nCode == 0)
{
PMSLLHOOKSTRUCT mhs = (PMSLLHOOKSTRUCT)lParam;

if (mhs->pt.x != pt.x || mhs->pt.y != pt.y)
{
pt.x = pt.x - (mhs->pt.x - pt.x);
pt.y = pt.y - (mhs->pt.y - pt.y);

if (pt.x < 0) pt.x = 0;
if (pt.y < 0) pt.y = 0;
if (pt.x >= Screen.cx) pt.x = Screen.cx - 1;
if (pt.y >= Screen.cy) pt.y = Screen.cy - 1;
SetCursorPos(pt.x, pt.y);
return TRUE;
}
}
return CallNextHookEx(NextHook, nCode, wParam, lParam);
}
__declspec(dllexport) void StartHook()
{
Screen.cx = GetSystemMetrics(SM_CXSCREEN);
Screen.cy = GetSystemMetrics(SM_CYSCREEN);
GetCursorPos(&pt);
NextHook = SetWindowsHookEx(WH_MOUSE_LL, LowLevelMouseProc, Module, 0);
}
__declspec(dllexport) void StopHook()
{
UnhookWindowsHookEx(NextHook);
}

相关VC6.0控制鼠标反方向移动

咨询热线:020-85648757 85648755 85648616 0755-27912581 客服:020-85648756 0755-27912581 业务传真:020-32579052
广州市网景网络科技有限公司 Copyright◎2003-2008 Veelink.com. All Rights Reserved.
广州商务地址:广东省广州市黄埔大道中203号(海景园区)海景花园C栋501室
= 深圳商务地址:深圳市宝源路华丰宝源大厦606
研发中心:广东广州市天河软件园海景园区 粤ICP备05103322号 工商注册