16,553
社区成员
发帖
与我相关
我的任务
分享
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'strfile 保存路径
Dim strFile As String = "c:\1"
'抓拍摄像头
Dim hBmp As IntPtr = Marshal.StringToHGlobalAnsi(strFile & ".bmp")
SendMessage(hWndC, WM_CAP_SAVEDIB, 0, hBmp.ToInt64())
'压缩图片
Dim sBmp As Bitmap = Bitmap.FromFile(strFile & ".bmp")
sBmp.Save(strFile & ".jpg", Imaging.ImageFormat.Jpeg)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'strfile 保存路径
Dim strFile As String = "c:\1"
'抓拍摄像头
Dim hBmp As IntPtr = Marshal.StringToHGlobalAnsi(strFile & ".bmp")
SendMessage(hWndC, WM_CAP_SAVEDIB, 0, hBmp.ToInt64())
'压缩图片
Dim bmpData As Byte() = IO.File.ReadAllBytes(strFile & ".bmp")
Dim ms As New IO.MemoryStream(bmpData)
Dim sBmp As Bitmap = Bitmap.FromStream(ms)
sBmp.Save(strFile & ".jpg", Imaging.ImageFormat.Jpeg)
End Sub