Results 1 to 2 of 2

Thread: how would I...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Location
    Ca
    Posts
    93

    Red face

    What would be the code to automaticly take a screen capture then print it?
    Timbudtwo
    I have no life, only one with computers.

    VB 6.0 Enterprise Edition
    [hr]

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    Smile try this...

    'screen grab...command1 and picture1 required
    '
    Private Declare Function GetDC Lib "user32" _
    (ByVal hwnd As Long) As Long

    Private Declare Function StretchBlt Lib _
    "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long


    Private Sub Command1_Click()
    Dim wScreen As Long
    Dim hScreen As Long
    Dim w As Long
    Dim h As Long
    Picture1.Cls

    wScreen = Screen.Width \ Screen.TwipsPerPixelX
    hScreen = Screen.Height \ Screen.TwipsPerPixelY

    Picture1.ScaleMode = vbPixels
    w = Picture1.ScaleWidth
    h = Picture1.ScaleHeight


    hdcScreen = GetDC(0)

    r = StretchBlt(Picture1.hdc, 0, 0, w, h, hdcScreen, 0, 0, wScreen, hScreen, vbSrcCopy)

    End Sub

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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