Results 1 to 11 of 11

Thread: SendKeys PrntScrn

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397

    SendKeys PrntScrn

    Is there a way to use sendkeys to do a print screen?

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    No.

    You can use bitblt though.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397
    what is bitblt

  4. #4
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    API.

  5. #5
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    try:

    Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)


    Call keybd_event(vbKeySnapshot, 0, 0, 0)
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397
    Originally posted by BuggyProgrammer
    try:

    Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)


    Call keybd_event(vbKeySnapshot, 0, 0, 0)
    That's GREAT.......




    Now I just need to find some way to get it to work in VBA....

  7. #7
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    i tested, it works. make sure

    Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

    is at the TOP of everything.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397
    It does work!!!!!

    how would I then save it.

    C:\test.....

    ??

    I found some code but it does not work in Access.
    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 Sub Command1_Click()
    
     '1 is the screen. Replace it with 0 and you'll get the form
       keybd_event vbKeySnapshot, 0, 0&, 0&
    
       DoEvents
    
        SavePicture Clipboard.GetData(vbCFBitmap), "C:\Test.bmp"
       
       Clipboard.Clear
       
    End Sub
    Last edited by texas; Aug 13th, 2002 at 05:25 PM.

  9. #9
    Lively Member Liquid Pennies's Avatar
    Join Date
    Jun 2002
    Location
    Charlotte, NC
    Posts
    124
    VB Code:
    1. Private Declare Function GetDesktopWindow Lib "USER32" () As Long
    2. Private Declare Function GetDC Lib "USER32" (ByVal hWnd As Long) As Long
    3. Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    4.  
    5. Public Sub SaveDesktop(FilePath As String)
    6. Dim A As Long
    7. Dim s As Long
    8. A = GetDesktopWindow()
    9. s = GetDC(A)
    10. Picture1.Width = Screen.Width / Screen.TwipsPerPixelX
    11. Picture1.Height = Screen.Height / Screen.TwipsPerPixelY
    12. BitBlt Picture1.hDC, 0, 0, Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY, s, 0, 0, vbSrcCopy
    13. SavePicture Picture1.Image, FilePath
    14. End Sub

    Does it without loosing your clipboard data

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397
    Did you get that to work in Access?

    If so what did you reference?

  11. #11
    Lively Member Liquid Pennies's Avatar
    Join Date
    Jun 2002
    Location
    Charlotte, NC
    Posts
    124
    i dont know if it would work in access...didnt try it

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