文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>VC6.0控制鼠标反方向移动

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

时间:2010-10-13  来源:teiller2008

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

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载