17 Ocak 2012 Salı

Ekran Görüntüsü Alma

Posted by Unknown On 13:13 No comments

Arkadaşlar form1 e  bir command button ve bir tane picturebox ekleyin.

---------------------------------------------------------------------------------------------

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 Command1_Click()
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)


SavePicture Picture1.Image, "D:\görüntü1.bmp"   '=====> bu da kaydetme
Picture1.Refresh
End Sub

---------------------------------------------------------------------------------------

0 yorum:

Yorum Gönder