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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Castch PrintSrcn key

Status
Not open for further replies.

AdaHacker

Programmer
Sep 6, 2001
392
US
All I want to do is detect when the PrintScrn key is pressed so that I can print my form. Sounds easy, but I can't get it to work. I tried the keypress event, but apparently that doesn't pick up special keys liek PrintScrn, the function keys, etc.
There's got to be a way to do this. Anyone know how?
 
Look at "KeyAscii". You need to include the control key mask.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
What do you mean, "control key mask?" Could you be a little more specific?

I've given up on the KeyPress event, as it doesn't seem to catch any of the function keys, the arrows, or anything but actual characters. The KeyDown event seems to be more in line with what I need, but it seems Windows is still catching the PrintScrn key. Is there a way to stop this that wouldn't be about 600,000,000 times harder than just using F12?
 
Look up the various "KeyCodeConstants". The "Print Screen" key is vbKeyPrint (42), then look at the vbShiftConstants (vbShiftMask, vbCtrlMask, vbAltMask). Since the "Print Screen Key has different responses when one of these is 'also present'. If you need to capture the User Actions, You will need to code for these as well as the simple "Print Scrn" key itself.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
I "Tripped" over this.

thread222-173993

Look at what they are dooing.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Thanks MichaelRed. I think I've figured it out now. After a little playing around, I found that, for some reason, the PrintScreen key only reponds to the KeyUp event, not KeyPress or KeyDown. Doesn't make much sense to me, but that's the way it seems to work. The Windows key doesn't seem to fire any of the events at all, which seems a little odd as well, but I'm not working with that one, so I really don't care.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top