Results 1 to 6 of 6

Thread: screen capture problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2001
    Posts
    8

    screen capture problem

    I am trying to execute a screen capture. My problem is the first time I click the command button it shows the last picture. I have to click it twice to get a new picture here is my code.

    *Credits to Matthew Gates for some of the code.



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


    Public Const VK_SNAPSHOT = &H2C
    Public Const KEYEVENTF_EXTENDEDKEY = &H1
    Public Const KEYEVENTF_KEYUP = &H2



    Private Sub cmdScreen_Click()
    Me.WindowState = vbMinimized
    DoEvents
    keybd_event vbKeySnapshot, 1, 0, 0
    keybd_event vbKeySnapshot, 0, KEYEVENTF_KEYUP, 0
    Form2.Picture = Clipboard.GetData(vbCFBitmap)
    Form2.Show
    End Sub
    ooooooh squishy

  2. #2
    Matthew Gates
    Guest
    Try using the Cls method to clear the form.


    VB Code:
    1. Me.Cls

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2001
    Posts
    8
    where should I put the .cls command?
    ooooooh squishy

  4. #4
    Matthew Gates
    Guest
    VB Code:
    1. Private Sub cmdScreen_Click()
    2. Me.Cls
    3. Me.WindowState = vbMinimized
    4. DoEvents
    5. keybd_event vbKeySnapshot, 1, 0, 0
    6. keybd_event vbKeySnapshot, 0, KEYEVENTF_KEYUP, 0
    7. Form2.Picture = Clipboard.GetData(vbCFBitmap)
    8. Form2.Show
    9. End Sub

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2001
    Posts
    8
    It didn't work
    ooooooh squishy

  6. #6
    Matthew Gates
    Guest
    Try:


    VB Code:
    1. Form2.Picture = LoadPicture()

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