I've used the following code to make a dll to install a keyboard hook for me. Everything works fine, however, when i'm using qeditor and running my program, and i press F2, the search box does not appear. It does appear when my program isn't running. Is my program not calling the next hook correctly?

.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib

.data hInstance DD 0
.data? hHook DD ? hWnd DD ?
.code DllEntry PROC hInst:HINSTANCE,Reason:DWORD,Res:DWORD push hInst pop hInstance mov eax,TRUE ret DllEntry ENDP
KeyboardProc PROC nCode:DWORD,wParam:DWORD,lParam:DWORD invoke CallNextHookEx,hHook,nCode,wParam,lParam mov eax,wParam cmp eax,VK_SHIFT je DontSend cmp eax,VK_MENU je DontSend cmp eax,VK_CONTROL je DontSend mov eax,lParam shr eax,31 cmp al,0 je DontSend invoke PostMessage,hWnd,WM_KEYBOARDHOOK,wParam,lParam DontSend: ret KeyboardProc ENDP
InstallHook PROC hwnd:DWORD push hwnd pop hWnd invoke SetWindowsHookEx,WH_KEYBOARD,ADDR KeyboardProc,hInstance,NULL mov hHook,eax ret InstallHook ENDP
UninstallHook PROC invoke UnhookWindowsHookEx,hHook ret UninstallHook ENDP
End DllEntry
This message was edited by martin, on 1/27/2001 11:07:53 PM
Posted on 2001-01-27 23:03:00 by martin
Ummm, im not sure on this, but i think you might be right in a way, your hook proc, i think is meant to do something special under a certain condition, i dont know, look it up in win32.hlp
Posted on 2001-01-28 06:04:00 by X
if you use callback procedures you have to care about hook-codes! use hc_action & hc_noremove to check if some data is present. if the hook-code is less than zero you MUST pass the parameters to the next hook-proc in the chain (use callnexthookex AND RETURN THE RESULT!). i don't know this exactly but i think otherwise the returen value should be zero (xor eax,eax). good luck... attachement: keyboardproc proc ncode:DWORD,wparam:DWORD,lparam:DOWRD .if code == HC_ACTION do something (see api-reference) .elseif code == HC_NOREMOVE do something (see api-reference) .elseif code < 0 invoke callnexthookex,hookhandle,ncode,wparam,lparam .else ;as i said above i'm not sure on this xor eax,eax ;as i said above i'm not sure on this .endif ret keyboardproc ends This message was edited by drcmda, on 1/29/2001 3:11:43 AM
Posted on 2001-01-29 03:04:00 by drcmda