Oke cekidot deh yah, yang paling penting kita harus ada camera atau webcame. instal terlebih dahulu sampai bisa digunakan. Setelah itu masuk ke project kita. Buat modul baru untuk menyimpan variabel dan deklarasi yang nantinya akan di panggil di setiap form yang di butuhkan.
> Pilih menu Project > Add Module > Open
> Lalu paste code di bawah ini
Public Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long
Public Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Public Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function ReleaseCapture Lib "user32" () As Long
Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Public Const RGN_OR = 2
Public Const WM_NCLBUTTONDOWN = &HA1
Public Const HTCAPTION = 2
> Lalu masukan code dibawah ini pada tombol yang akan mengeksekusi gambar tersebut
'menyalakan camera> Tarraaa. Gambar sudah di ambil. selanjutnya tinggal kalian kombinasikan dengan cara menyimpan gambar tersebut di drive kalian.
STARTCAM
continue = True
Do While continue
SendMessage mCapHwnd, GET_FRAME, 0, 0
SendMessage mCapHwnd, COPY, 0, 0
picInput.Picture = Clipboard.GetData ' menampilkan di image picture
DoEvents
Loop
'memberhentikan kamera atau mengambil gambar/capture
STOPCAM
continue = False
Note :
Tambahkan image picture untuk preview gambar dari camera
Semoga bermanfaat
ok. dilengkapi sekalian simpan nya jga
ReplyDelete