Project1
标题:
API编译
[打印本页]
作者:
yangff
时间:
2008-2-21 20:10
标题:
API编译
我不是学C++的,所以不大会用
麻烦把这个代码看下。
顺便帮忙编译下。
// Mouse Dynamic Link Library.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include <"stdio.h">
#include <"windows.h">
// API
[DllImport("user32.dll")]
public static extern short GetKeyState(int nVirtKey);
public const int VK_LBUTTON = 1;
public const int VK_RBUTTON = 2;
int x,y;
long l;
long hd;
long KeyTepy;
bool Mouse_Open;
// API
CPoint point;
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
extern long start(long hWnd)
{
Mouse_Open = true;
hd = hWnd;
}
extern long __stdcall Get_Tepy()
{
return KeyTepy;
}
extern long __stdcall Get_Pos_X()
{
return x;
}
extern long __stdcall Get_Pos_Y()
{
return x;
}
extern long __stdcall Mouse_Close()
{
Mouse_Open = false;
}
extern int Updata_Mouse()
{
KeyTepy = 0;
GetCursorPos(&point);
ScreenToClient(hd,&print);
x = point.x;
y = point.y;
if (GetKeyState(VK_LBUTTON) & 0x80) == 0x80
{
KeyTepy = 1;
};
if (GetKeyState(VK_RBUTTON) & 0x80) == 0x80
{
KeyTepy = 2;
};
if (((GetKeyState(VK_LBUTTON) & 0x80) == 0x80) &&
((GetKeyState(VK_RBUTTON) & 0x80) == 0x80))
{
KeyTepy = 3;
};
}
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1