Selasa, 02 Februari 2010

cara mengambil gambar layar dengan VB

| Selasa, 02 Februari 2010 | 0 komentar
Selamat membaca artikel diblog ini semoga bermanfaat :)

Tanpa basa - basi lagi
ni dia caranya:

yang diperlukan adalah 2 command, 1 common dialog,1 timer,dan sebuah picture box
lalu atur propertinya:
command 1
caption : "Run"
command 2
caption : "Save"
timer 1
interval : "1000"

Code:

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

Private Sub Command1_Click()
If Command1.Caption = "Run" Then
Timer1.Enabled = True
Command1.Caption = "Stop"
Else
Timer1.Enabled = False
Command1.Caption = "Run"
End If
End Sub

Private Sub Command2_Click()
With Me.CommonDialog1
.DialogTitle = "Save gambar"
.Filter = "Bmp|*.bmp"
.CancelError = False
.ShowSave
If Len(.FileName) <> 0 Then
SavePicture Me.Picture1.Image, .FileName
End If
End With
End Sub

Private Sub Timer1_Timer()
If Second(Now) = 30 Then
keybd_event vbKeySnapshot, 0, 0&, 0&
PaintPicture Picture1.Image, 0, 0, Picture1.Width, Picture1.Height
Picture1.PaintPicture Clipboard.GetData(vbCFBitmap), 0, 0, Picture1.Width, Picture1.Height
For i = 1 To Len(Now)
If IsNumeric(Mid(Now, i, 1)) Then datagam = datagam & Mid(Now, i, 1)
Next i
SavePicture Clipboard.GetData(vbCFBitmap), App.Path & "\" & datagam & ".bmp"
End If
End Sub

mungkin ini berguna untuk mengambil gambar dari sebuah halaman web atau desktop

seperti:


0 komentar :

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Posting Komentar

 

Blogroll

Flagcounter

free counters
© Copyright 2010. K-blogger . All rights reserved | K-blogger is proudly powered by Blogger.com | Template by o-om.com - zoomtemplate.com
Pasang Iklan Gratis Sebagai Awal Mulai Bisnis Online