2012-07-16
展开全部
I am pretty sure A and B will work in my code, but not sure about num1 and num2
Please try the following code and let me know if you have a question.
Hope you find this helpful
#include <windows.h>
while(1){ // enter the while loop, if A or B is pressed then trigger certain function
if(GetAsyncKeyState('A')){ // if A is pressed
// do something
Sleep(250);
}
if(GetAsyncKeyState('B')){ // if B is pressed
// do something
Sleep(250);
}
}
Please try the following code and let me know if you have a question.
Hope you find this helpful
#include <windows.h>
while(1){ // enter the while loop, if A or B is pressed then trigger certain function
if(GetAsyncKeyState('A')){ // if A is pressed
// do something
Sleep(250);
}
if(GetAsyncKeyState('B')){ // if B is pressed
// do something
Sleep(250);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询