Results 1 to 7 of 7

Thread: Print Screen

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Question

    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.

  2. #2
    Guest
    You cannot send Print Screen key to an App. It says so in the MS Help file too.


  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Arrow Thanks Megatron, but

    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 the
    Code:
    Sendkeys "{PRTSC}"
    statement?

    Can it even be used at all and, if so, how? If not, why was the statement included in the SendKeys Help information?

    Thanks.

  4. #4
    Guest
    Yes but, go to the very bottom of the Help File and it will also say this.

    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.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Unhappy Going in circles ...

    Megatron, I've read that, but my question from my previous post remains [quote]How do you use the
    Code:
    Sendkeys "{PRTSC}"
    statement?

    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.


  6. #6
    Lively Member
    Join Date
    May 1999
    Location
    KC
    Posts
    72

    Lightbulb I got it!

    You can use the keybd_event API to do a print screen:

    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
    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:
    keybd_event VK_SNAPSHOT, 1, 0, 0
    For more info:
    http://msdn.microsoft.com/library/wc...dkr/uif_kl.htm


    [Edited by delker on 06-26-2000 at 05:09 PM]

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Thumbs up Thanks ....

    Delker, you were right. Your code did exactly what I was looking for. Megatron, thanks for your help also.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width