;Hello all! ;Trying to get a simple KeyHook program working. ;I'm missing a lot, I know, but this is as far as i got. ;I want it to copy all keypresses into a a file, ;and put the file in the same dir. ;Any suggestions? , if you read this, i need your ;help man... ;Thanks ;Source: ;Much needed work... .386 .model flat,stdcall option casemap:none GetKeys proto :DWORD,:DWORD,:DWORD,:DWORD include C:\masm32\include\kernel32.inc include C:\masm32\include\user32.inc include C:\masm32\include\windows.inc include C:\masm32\include\gdi32.inc includelib C:\masm32\lib\user32.lib includelib C:\masm32\lib\kernel32.lib includelib C:\masm32\lib\gdi32.lib .data KeyFile db "KeyFile",0 ;File to be written in... .data? hInstance HINSTANCE ? CommandLine LPSTR ? Buffer db dup 256 (?) ;512 (?) rather? .code start: invoke GetKeys,addr KeyFile invoke ExitProcess,0 GetKeys hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM invoke SetWindowsHookEx,WH_KEYBOARD,?,hInstance,? invoke GetKeyboardState,addr Buffer invoke GetKeyNameText,16,addr Buffer,256 GetKeys endp end start
Posted on 2000-12-06 16:56:00 by Nok
if u want to hook all key pressed message, u have to hook in the .dll file. See Iczelion's Tutorial, there is the sample code. Or if u want, I have writen the screen capture program that hook both key pressed and mouse click, if u want i can sending the code to u.
Posted on 2000-12-06 22:11:00 by doby
my suggestion was to still call invoke SetWindowsHookEx, but after that you must call the KeyboardProc function. ;-----start----- GetKeys hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM invoke SetWindowsHookEx,WH_KEYBOARD,NULL,hInstance,NULL .if uMsg==WH_KEYBOARD ;KeyboardProc,code,wParam,lParam ;code: either HC_ACTION (take the key and throw it out of the ;queue, or HC_NOREMOVE (keep key in queue) ;I supose it would be easyer to just keep HC_ACTION ;wParam: Specifies the virtual-key code of the key that ;generated the keystroke message. ;lParam Specifies the repeat count, scan code, extended-key ;flag, context code, previous key-state flag, and transition- ;state flag. This parameter can be a combination of the ;following values: (conult Win32 Programmer's Reference) invoke KeyboardProc,HC_ACTION,wParam,lParam ;----end--- so now you can proccess the key stroke, if im wrong let me know. just read the whole section the the KeyboardProc function.
Posted on 2000-12-06 22:38:00 by rage9
hey sorry nok, was it you i wanted to send the source to? sorry. im sendin' it now......
Posted on 2000-12-07 12:13:00 by [SaFc0n]
Thanks SaFc0n!!!
Posted on 2000-12-07 12:30:00 by Nok