21,599
社区成员
发帖
与我相关
我的任务
分享
#include <windows.h>
#include "winio.h"
#include <iostream>
using namespace std;
void KBCWait4IBE()
{
DWORD dwRegVal=0;
do
{
Sleep(1);
GetPortVal(0x64,&dwRegVal,1);
}
while(dwRegVal & 0x01); //1还是2呢?我太确定,我觉得是1,但是我看到很多其他的源码是2
}
void SetByte(unsigned char uPort, unsigned char uCode)
{
Sleep(1);
KBCWait4IBE();
SetPortVal(uPort, uCode, 1);
}
void LeftButtonDown()
{
SetByte(0x64,0xD3); SetByte(0x60,0x09);
SetByte(0x64,0xD3); SetByte(0x60,0x00);
SetByte(0x64,0xD3); SetByte(0x60,0x00);
SetByte(0x64,0xD3); SetByte(0x60,0x00);
}
void LeftButtonUp()
{
SetByte(0x64,0xD3); SetByte(0x60,0x08);
SetByte(0x64,0xD3); SetByte(0x60,0x00);
SetByte(0x64,0xD3); SetByte(0x60,0x00);
SetByte(0x64,0xD3); SetByte(0x60,0x00);
}
int wmain(int argc, wchar_t* argv)
{
if(InitializeWinIo()==false) cout << "驱动程序加载失败! " <<endl;
else{
Sleep(3000);
LeftButtonDown();
Sleep(1000);
LeftButtonUp();
//SetByte(0x64,0xD2);
//SetByte(0x60,0x1E);
ShutdownWinIo();
}
}