12345678910111213141516171819202122
#include <windows.h> #include <iostream> #include <fstream> using namespace std; int main() { int counter=0; ofstream myfile; myfile.open("basic.txt"); while(true) { if(GetAsyncKeyState(VK_ESCAPE)) { counter++; myfile <<"Escape : " <<counter; cout<<"Button pressed !"<<endl; } Sleep(100); } return 0; }
123
VOID WINAPI Sleep( __in DWORD dwMilliseconds );
1234567891011121314151617181920212223242526
#include <windows.h> #include <iostream> #include <fstream> using namespace std; int main() { int counter=0; ofstream myfile; myfile.open("please.txt"); while(true) { if(GetAsyncKeyState(VK_ESCAPE)) { counter++; myfile <<"Escape : " <<counter; cout<<"Button pressed !"<<endl; if(GetAsyncKeyState(VK_ENTER)) { myfile <<"." << counter; } } Sleep(100); } return 0; }