# Solved: Full keyboard capture in vb



## Wondered2001 (Oct 9, 2008)

Hi there, I've looked and cant find anything...maybe one of you do. Is there a way to have a VB program capture ALL keyboard input? I wrote a program to prevent my kids from randomly clicking things, which works unless they get the windows key which bypasses the whole point of the program. Eventually I will rewrite in VC++ so any help towards that would be appreciated as well


----------



## -Fabez- (Jul 28, 2008)

Why do you want to make a global keyboard hook ?


----------



## Wondered2001 (Oct 9, 2008)

I wrote a program to let my kids randomly click things, which works unless they get the windows key which bypasses the whole point of the program. not worried about catching multiple keys like ctrl/alt/delete, just dont want to keep having to barricade computer if I walk away from computer for a minute. can show coding to date if you're interested


----------



## Wondered2001 (Oct 9, 2008)

btw, realizing potential for creating problems if code is given out... if you're not comfortable telling, I'm still looking on my own and eventually will make it work. Was hoping to finish before kids are old enough to help me is all ;-)


----------



## -Fabez- (Jul 28, 2008)

Im comfortable telling you, I just dont fully get why you want to monitor all of the keys that are pressed on your computer.


----------



## Wondered2001 (Oct 9, 2008)

sorry for delay in response. The program is supposed to let the kids hit any key on keyboard or click any button on mouse, without me worrying about them deleting the folder holding all their photos or who knows what. basically it puts a full screen image on screen that changes colors randomly when any key is hit, mouse wheel scrolled... whatever. It works great except for if the windows key is hit... it bypasses the whole program bringing up the taskbar and potentially lets em click on anything. I wrote it originaly to amuse daughter who found it fun, the 1yr old son has a definite passion for the keyboard and has literaly climbed stuff I couldnt to get past the barriers we put in his way. A little wordy, but hope reason is clearer. I did find a low level keyboard hook that should work, but if you have an easier way to catch the windows key I'd love to hear it.


----------



## pvc_ (Feb 18, 2008)

If you can currently get the key code for the Windows Key ( I dont know how you implemented the program that you have right now), then you can resize the form to get the focus back. Do a quick resize, and then maximize the windows again. Another good trick is to send a pop up message to the screen to get the focus back and get rid of the start menu. 

I usually code this kind of stuff in .net and to get the key code, I just use the Form_KeyDown event, and the "e" argument that is passed to it.


----------

