I can trap the VK_LWIN/RWIN keypresses by subclassing the edit control and testing the WM_KEYDOWN/UP messages. I'm wondering how I can keep windows from receiving that message though after my app has done what it needs to with it. As it stands the start menu still pops up.


thanks,
will
Posted on 2003-07-21 16:15:07 by Will
Will
LWIN and RWIN is a special key.
I trap their using SetWindowsHookEx(WH_KEYBOARD_LL) under NT family.
Posted on 2003-07-21 22:23:21 by P2M
Thanks P2M. I hadn't thought of trying that.

After reading your reply I did try it though, and am able to trap the WM_KEYDOWN and UP messages, but the start menu still pops up after the WM_KEYUP. Maybe someone could look at my LowLevelKeyboardProc and tell me what the problem is?



KBProc proc nCode:DWORD,wParam:DWORD,lParam:DWORD
.if nCode < 0
invoke CallNextHookEx,hHook,nCode,wParam,lParam
ret
.endif
invoke CallNextHookEx,hHook,nCode,wParam,lParam
mov edx,lParam
assume edx:PTR KBDLLHOOKSTRUCT
.if wParam == WM_KEYDOWN || wParam == WM_KEYUP
.if [edx].vkCode == VK_LWIN || [edx].vkCode == VK_RWIN
;invoke MessageBox,0,0,0,0 ;testing
assume edx:nothing
mov eax,1
ret
.endif
.endif
assume edx:nothing
xor eax,eax
ret
KBProc endp


I basically ripped the MouseProc from Iczelion's tut #24, and added the nCode < 0 test after reading the msdn reference for the LowLevelKeyboardProc.

thanks,
will
Posted on 2003-07-23 14:38:58 by Will
Nevermind, I found my mistake.


thanks,
will
Posted on 2003-07-23 17:04:06 by Will