Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create a keyboard hook

Status
Not open for further replies.

smayshar

Programmer
Aug 30, 2003
42
0
0
AU


How do I create a keyboard hook that would reject
the prnt scrn key???
thenks
 
This particular constant, doesn't work on my laptop, maybe a desktop?

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyPrint Then MsgBox "Yes" Else MsgBox "No"
End Sub

You must set the "KeyPreview" property of the form (in the Events tab), to yes.

If vbKeyPrint doesn't work, try vbKeyShift, just to give you an idea of the potential.

Setting the keycode to 0, disables the key press action, so the idea is something like...

If KeyCode = vbKeyPrint Then KeyCode = 0

Hope this offers some direction.

Good Luck either way!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top