| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1470 人关注过本帖
标题:控制鼠标反方向移动如果编译成可执行文件?
取消只看楼主 加入收藏
happymao
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-12-28
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:5 
控制鼠标反方向移动如果编译成可执行文件?
网上看到有控制鼠标反方向移动这个VC的代码,想编译成可执行文件,请哪位给编译一下?谢谢!

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

 

 

急用这个,但不懂,哪位高手,帮助一下,编译成可执行文件吧,非常感谢!
搜索更多相关主题的帖子: 编译 文件 鼠标 
2009-12-28 22:27
happymao
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-12-28
收藏
得分:0 
不可行吗?
2009-12-29 22:53
happymao
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-12-28
收藏
得分:0 
老大,你就直接帮我编译成可执行文件吧,谢谢你了!急啊急啊,编译不是这个错误就是那个错误 ,郁闷啊!
-------------------Configuration: 1 - Win32 Debug--------------------
Compiling...
1.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(10) : error C2065: 'PMSLLHOOKSTRUCT' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(10) : error C2146: syntax error : missing ';' before identifier 'p'
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(10) : error C2065: 'p' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(10) : error C2146: syntax error : missing ';' before identifier 'l'
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(13) : error C2227: left of '->pt' must point to class/struct/union
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(13) : error C2228: left of '.x' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(13) : error C2227: left of '->pt' must point to class/struct/union
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(13) : error C2228: left of '.x' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(14) : error C2227: left of '->pt' must point to class/struct/union
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(14) : error C2228: left of '.y' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(14) : error C2227: left of '->pt' must point to class/struct/union
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(14) : error C2228: left of '.y' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(15) : error C2227: left of '->pt' must point to class/struct/union
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(15) : error C2228: left of '.x' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(15) : error C2227: left of '->pt' must point to class/struct/union
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(15) : error C2228: left of '.y' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(25) : error C2065: 'WH_MOUSE_LL' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(31) : error C2065: 'fprintf' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\1\1.cpp(31) : error C2065: 'stderr' : undeclared identifier
执行 cl.exe 时出错.

急啊,帮帮忙吧!

[ 本帖最后由 happymao 于 2009-12-30 23:13 编辑 ]
2009-12-30 22:01
happymao
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-12-28
收藏
得分:0 
哪位好心人或者高手,帮助一下吧,直接帮我编译成可执行文件吧,成不?
2009-12-30 23:14
happymao
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-12-28
收藏
得分:0 
非常感谢楼上的老大,可惜,可能是动态链接库的原因,我这无法运行,提示:
由于应用程序配置不正确,应用程序未能启动。重新安装应用程序可能会纠正这个问题。
正在网上查找原因中……
2009-12-31 09:51
happymao
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-12-28
收藏
得分:0 
嗯,可以运行了,非常感谢
2009-12-31 14:56
快速回复:控制鼠标反方向移动如果编译成可执行文件?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016942 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved