-
-
请帮忙看下这些代码~
-
发表于:
2009-2-11 12:30
4105
-
#include <windows.h> //headerfile
bool on=false; //boolean value false
void norecoil(void)
{
while (1){ //runs forever
Sleep(1); //not use cpu
if(GetAsyncKeyState(VK_F12)& (1==1)){
on=!on;
} //on and off keys
if(GetAsyncKeyState(VK_F10)&& GetAsyncKeyState(VK_F9)){
break;
} //get out of the loops, turn off programme
if(on){
int cx = GetSystemMetrics(SM_CXSCREEN)/2; //get resolution
int cy = GetSystemMetrics(SM_CYSCREEN)/2; //get resolution
}
while (on){
Sleep(100);
while (GetAsyncKeyState(VK_LBUTTON) < 0){
Sleep(100);
SetCursorPos(x,y+20);
}
if(GetAsyncKeyState(VK_F12)& (1==1)){
on=!on;
}//on off
if(GetAsyncKeyState(VK_F10)&& GetAsyncKeyState(VK_F9)){
break;
}//turn off
}
}
}
int WINAPI DllMain( HANDLE hmModule, DWORD dwReason, LPVOID lpUseless )
{
switch( dwReason )
{
case DLL_PROCESS_ATTACH:
CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) norecoil, NULL, 0, new DWORD );
}
return 1;
}
上面是朋友给我的代码,我怎么都觉得不全,我不会编译,他告诉我直接编译成DLL就可以了,结果用VC出现这样的结果:
--------------------Configuration: 4 - Win32 Debug--------------------
Compiling...
4.cpp
d:\bl\1\1.cpp(24) : error C2065: 'X' : undeclared identifier
d:\bl\1\1.cpp(24) : error C2065: 'Y' : undeclared identifier
执行 cl.exe 时出错.
4.dll - 1 error(s), 0 warning(s)
问题出在什么地方?怎么修改?请教高手..XY定义错或没定义,请哪位大哥帮忙定义下,看看问题的所在,这里万分感谢!
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!