i have no idea about hte part where it says "if GetAsyncKeyState(vkey)" this is what some guy gave me i need it to be able to read if any key is being pressed
#include <iostream>
#include <Windows.h>
usingnamespace std;
int main()
{
int key;
while (true)
{
if GetAsyncKeyState(vkey)
{
printf("button has been pressed \n");// if a key is being held down
}
else
{
printf("button is not pressed \n");// if no button is held down
}
}
}
#include <conio.h>
#include <windows.h>
#define _VK_P 0x50
void _clrscr()
{
COORD Home={0,0};
DWORD Written;
HANDLE conOut=GetStdHandle(STD_OUTPUT_HANDLE);
FillConsoleOutputCharacter(conOut, //The specified HANDLE , in this case Output Handle
(TCHAR)' ', //Fill The screen buffer with spaces(or other character)
10, //How many spaces(or other character) to fill with
Home, //Start filling with spaces from coordinates 0,0
&Written); //The Written variable shows the characters(spaces in this case) actually written
SetConsoleCursorPosition(conOut,Home); //Set cursor position back to 0,0
}
int main()
{
int key;
_cputs("Press \'P\'");
while(true)
{
if(GetAsyncKeyState(_VK_P))
break;
}
_clrscr();
_cputs("Congrats you passed the test\n\n");
_cputs("Oh and the other key you presed are : ");
while(kbhit()) _getche(),putch(',');
// _cputs("\b\b\b. ");
_getch();
return 0;
}