ekran görüntüsü almak

Visual Basic bölümünde yer alan bu konu Mr.Jackson tarafından paylaşıldı.

  1. Mr.Jackson

    Mr.Jackson Sagopa Kajmer

    visual basic kodu



    Option Explicit

    Private Declare Function GetDesktopWindow Lib "user32" () As Long
    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
    Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function ReleaseDC Lib "user32" _
    (ByVal hwnd As Long, ByVal hDC As Long) As Long

    Private Sub say_Timer()
    On Error Resume Next
    Dim hd, w, h ' Geri dönüş değişkenleri
    Picture1.AutoRedraw = True ' Resmin görüntüleme içIn

    w = Screen.Width / Screen.TwipsPerPixelX ' Resim boyutu
    h = Screen.Height / Screen.TwipsPerPixelY

    hd = GetDC(GetDesktopWindow())

    ' Resmi Belirtilen ResimKutusu objesine aktar

    Call BitBlt(Picture1.hDC, 0, 0, w, h, hd, 0, 0, &HCC0020)
    Call ReleaseDC(GetDesktopWindow(), hd)

    ' Resmi görüntülemek için yenile

    Picture1.Refresh
    End Sub