我的代码:引用AVICAP
我先把视频缓冲的内容读到内存,然后把内存的数据写成bitmap,看看我写的对吗?
Public Function MyFrameCheck(hDestBmp As Long) As Long
Dim VideoHeader As VIDEOHDR
Dim VideoData() As Byte
Dim X As Integer, y As Integer
Dim tDBmpInfo As BITMAP
Dim dBits() As Byte
'//Fill VideoHeader with data at lpVHdr
RtlMoveMemory VarPtr(VideoHeader), lpvhdr, Len(VideoHeader)
'// Make room for data
ReDim VideoData(VideoHeader.dwBytesUsed)
'//Copy data into the memory array
RtlMoveMemory VarPtr(VideoData(0)), VideoHeader.lpData, VideoHeader.dwBytesUsed
'get bitmap
Call GetObject(hDestBmp, Len(tDBmpInfo), tDBmpInfo)
Call SetBitmapBits(hDestBmp, tDBmpInfo.bmWidthBytes * tDBmpInfo.bmHeight, VarPtr(VideoData(0)))
Image1.Picture.Handle = hDestBmp
Dim c1 As Long 'Picture1的RGB颜色
Dim r As Boolean 'R分量
Dim g As Boolean
Dim b As Boolean
For X = 0 To tDBmpInfo.bmWidth - 1
For y = 0 To tDBmpInfo.bmHeight - 1
c1 = Image1.Point(X, y)
r = c1 And &HFF
g = (c1 And 65280) / 256
b = (c1 And &HFF0000) / 65536
If r = True And g = False And b = False Then
Label1.Caption = X
Label2.Caption = y
Exit For
End If
Next
Next
End Function