目前在做一个辅助程序,需要对一款游戏进行模拟按键,使用各种WIN API均无效 求winio在vc中的用法
voidKbcWait4IBE(){DWORDdwRegVal=0;do{GetPortVal(0x64,&dwRegVal,1);}while(dwRegVal&0x0...
void KbcWait4IBE()
{
DWORD dwRegVal=0;
do
{
GetPortVal(0x64,&dwRegVal,1);
}
while(dwRegVal & 0x00000002);
}
void KeyPress(BYTE byScancode)
{
KbcWait4IBE(); //Wait for KBC input buffer empty
SetPortVal(0x64,0xD2,1); //Send data back to the system command
KbcWait4IBE(); //Wait for KBC input buffer empty
SetPortVal(0x60,(ULONG)byScancode,1); //Send the key down scancode
KbcWait4IBE(); //Wait for KBC input buffer empty
SetPortVal(0x64,0xD2,1); //Send data back to the system command
KbcWait4IBE(); //Wait for KBC input buffer empty
SetPortVal(0x60,(ULONG)(byScancode | 0x80),1); //Send the key up scancode
}
这个是在网上找的winio看不明白也不会用,求高手解答
或者给出其他方法也行 展开
{
DWORD dwRegVal=0;
do
{
GetPortVal(0x64,&dwRegVal,1);
}
while(dwRegVal & 0x00000002);
}
void KeyPress(BYTE byScancode)
{
KbcWait4IBE(); //Wait for KBC input buffer empty
SetPortVal(0x64,0xD2,1); //Send data back to the system command
KbcWait4IBE(); //Wait for KBC input buffer empty
SetPortVal(0x60,(ULONG)byScancode,1); //Send the key down scancode
KbcWait4IBE(); //Wait for KBC input buffer empty
SetPortVal(0x64,0xD2,1); //Send data back to the system command
KbcWait4IBE(); //Wait for KBC input buffer empty
SetPortVal(0x60,(ULONG)(byScancode | 0x80),1); //Send the key up scancode
}
这个是在网上找的winio看不明白也不会用,求高手解答
或者给出其他方法也行 展开
1个回答
展开全部
虽然没做过,大致应该用hook,然后监听按键
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询