Is it possible to use Sendkeys to imitate someone pressing the "Print Screen" key? I haven't been successful trying to do it and then pasting the contents of the clipboard into a Rich Text Box.
Thanks.
Printable View
Is it possible to use Sendkeys to imitate someone pressing the "Print Screen" key? I haven't been successful trying to do it and then pasting the contents of the clipboard into a Rich Text Box.
Thanks.
You cannot send Print Screen key to an App. It says so in the MS Help file too.
that doesn't help. I also read in Help that you can't send the Print Screen key to an App. My question is, "How do you use thestatement?Code:Sendkeys "{PRTSC}"
Can it even be used at all and, if so, how? If not, why was the statement included in the SendKeys Help information?
Thanks.
Yes but, go to the very bottom of the Help File and it will also say this.
Quote:
Note You can't use SendKeys to send keystrokes to an application that is not designed to run in Microsoft Windows. Sendkeys also can't send the PRINT SCREEN key {PRTSC} to any application.
Megatron, I've read that, but my question from my previous post remains [quote]How do you use the
statement?Code:Sendkeys "{PRTSC}"
Can it even be used at all and, if so, how? If not, why was the statement included in the SendKeys Help information?[/code]
Whoever responds, please answer the above question.
You can use the keybd_event API to do a print screen:
when command1 is clicked, it will send an image of the window to the clipboard. If you want the whole screen's image copied, replace the call with this:Code:Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const VK_SNAPSHOT = &H2C
Private Sub Command1_Click()
keybd_event VK_SNAPSHOT, 0, 0, 0
End Sub
For more info:Code:keybd_event VK_SNAPSHOT, 1, 0, 0
http://msdn.microsoft.com/library/wc...dkr/uif_kl.htm
[Edited by delker on 06-26-2000 at 05:09 PM]
Delker, you were right. Your code did exactly what I was looking for. Megatron, thanks for your help also.