Link to home
Start Free TrialLog in
Avatar of lynnton
lynnton

asked on

Block system wide key

Hi Experts,

I'm able to block system wide keys using this project http://vbnet.mvps.org/index.html?code/hooks/lowlevelkeyboardproc.htm

I able to block ctrl.
I able to block numlock.

Problem is I can't block "Ctrl + numlock".

Please kindly guide me how to implement to block "Ctrl + numlock". vb6

Private Const VK_NUMLOCK = &H90

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Shane Russell
Shane Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
He made a dll to do it via low level access and it blocks a whole bunch of stuff, it comes with source code , etc :) Let me know if this helps you out any :)
Avatar of lynnton
lynnton

ASKER

gecko_au2003,

Do you think we can make it work using the method I've posted?

Blocking ctrl +numlock ?

Thanks.
If you add the code below :

      If (kbdllhs.vkCode = VK_NUMLOCK) And _
          CBool(GetAsyncKeyState(VK_CONTROL) _
          And &H8000) Then
         
        Debug.Print "Ctrl+ num blocked"
       
        LowLevelKeyboardProc = 1
        Exit Function

It requires that you hold down ctrl + shift and then numlock , but that works. I am trying to figure out how to get rid of the shift key part though.
ok I cant figure out why you have to hold shift down for the ctrl + numlock to work but thats all I could manage to figure out for now, since it is 6:24 am here.

It is pretty much the same from what I can see with regards to comparing it to the other examples on how to detect the key press of key combinations, so this looks like a toughy lol.
Avatar of lynnton

ASKER

gecko_au2003,

I'll repost this question and hope other experts would join.

-I had fun on your home page.

Thanks.

lol @ fun on my home page :) hopefully they can help you out because I cant understand why you have to use the shift key as well, thats got me stumped
Than Q for points and grade btw :)
What did you like about my home page , just outta curiousty ?