我做了一个视频程序,在显示图像的同时录取AVI文件,
就是在一个do while循环里反复调用两个函数,在VB环境
下编译后执行无问题,但是做成可执行文件后每次执行
EXE文件,执行程序都自动退出,编译后执行和直接执行
EXE文件有什么不同吗???????????
就是在一个do while循环里反复调用两个函数,在VB环境
下编译后执行无问题,但是做成可执行文件后每次执行
EXE文件,执行程序都自动退出,编译后执行和直接执行
EXE文件有什么不同吗???????????
解决方案 »
- 去除text1中的带有某字符@的特定一行 VB
- ACCESS与DATAGRID的连接问题
- 用vsnetmenu 的按钮图标时, 在按钮上加载了图标后, 有点图标的视图较大, 有点图标的视图又很小, 我查看过图标属性,都是32*32, 请问怎样解
- 急急急:请问怎样家用vb列出一个目录及其子目录下所有文件?
- 文本文件读写问题?急急急急急急
- 关于报表设计器的用法?
- 错误捕获相关问题,高手指教
- 如何在2个应用程序之间进行数据传递,使用DDE?
- 在窗体上同一个位置上放两个控件(比如:LABEL AND BUTTON),显示的前后顺序怎样控制?
- 谢谢,帮个忙,!!!!!!!!!感激不仅
- VB GPIB
- 急!如何模拟回车功能?
Private Sub Command7_Click()Dim Status As HVSTATUS
Dim i As Integer
'Dim pOpts As Long
'creat avi
Dim file As cFileDlg
Dim InitDir As String
Dim szOutputAVIFile As String
Dim res As Long
Dim pfile As Long 'ptr PAVIFILE
Dim bmp As cDIB
Dim ps As Long 'ptr PAVISTREAM
Dim psCompressed As Long 'ptr PAVISTREAM
Dim strhdr As AVI_STREAM_INFO
Dim BI As BITMAPINFOHEADER1
Dim opts As AVI_COMPRESS_OPTIONS
'Dim pOpts As Long
'Dim i As Long
Dim i1 As Long
Dim ntemp As Long
ntemp = Hv_Width * HV_Height - 1
ReDim pRawBuffer(0 To ntemp) '设置原始图像缓冲区大小
'分配Bayer转换后图像数据缓冲
ReDim pImageBuffer(0 To (Hv_Width * HV_Height * 3 - 1))
'Call avi
Status = STATUS_OK
' 启动数字摄像机采集图像到内存
bStart = True
Dim pLutR(0 To 255) As Byte
Dim pLutG(0 To 255) As Byte
Dim pLutB(0 To 255) As Byte For i = 0 To 255
pLutR(i) = i
pLutG(i) = i
pLutB(i) = i Next i
Dim ppBuf(0 To 0) As Long
ppBuf(0) = VarPtr(pRawBuffer(0))
'改变菜单的状态
' MenuStart(2).Enabled = False
' MenuStop(3).Enabled = True
'Call avi
'' Set file = New cFileDlg
'get an avi filename from user
'' With file
'' .DefaultExt = "avi"
'' .DlgTitle = "Choose a filename to save AVI to..."
'' .Filter = "AVI Files|*.avi"
'' .OwnerHwnd = Me.hWnd
'' End With
Dim tt, tt1, tt2 As String
tt = Format(Now, "ddddd ttttt")
tt1 = Replace(tt, " ", "-", (1), (11))
tt2 = Replace(tt1, ":", "-", 1)
szOutputAVIFile = "d:\avi\AVI" + tt2 + ".avi"
'' If file.VBGetSaveFileName(szOutputAVIFile) <> True Then Exit Sub
' Open the file for writing
res = AVIFileOpen(pfile, szOutputAVIFile, OF_WRITE Or OF_CREATE, 0&)
'If (res <> AVIERR_OK) Then MsgBox ("error") 'GoTo error 'Get the first bmp in the list for setting format
''Set bmp = New cDIB
''lstDIBList.ListIndex = 0
''If bmp.CreateFromFile(lstDIBList.Text) <> True Then
'' MsgBox "Could not load first bitmap file in list!", vbExclamation, App.title
'' GoTo error
'' End If' Fill in the header for the video stream
With strhdr
.fccType = streamtypeVIDEO 'mmioStringToFOURCC("vids", 0&) '// stream type video
.fccHandler = 0 '// default AVI handler
.dwScale = 1
.dwRate = 24 'Val(txtFPS) '// fps
.dwSuggestedBufferSize = 100 * 100 * 3 'bmp.SizeImage '// size of one frame pixels
Call SetRect(.rcFrame, 0, 0, 100, 100) '// rectangle for stream
End With
'validate user input
''' If strhdr.dwRate < 1 Then strhdr.dwRate = 1
''' If strhdr.dwRate > 30 Then strhdr.dwRate = 30' And create the stream
res = AVIFileCreateStream(pfile, ps, strhdr)
''' If (res <> AVIERR_OK) Then Print 11111 'GoTo error 'GoTo Error 'get the compression options from the user
'Careful! this API requires a pointer to a pointer to a UDT
pOpts = VarPtr(opts)
res = AVISaveOptions(Me.hWnd, _
ICMF_CHOOSE_KEYFRAME Or ICMF_CHOOSE_DATARATE, _
1, _
ps, _
pOpts) 'returns TRUE if User presses OK, FALSE if Cancel, or error code
''' If res <> 1 Then 'In C TRUE = 1
''' Call AVISaveOptionsFree(1, pOpts)
''GoTo error
''' End If
'make compressed stream
res = AVIMakeCompressedStream(psCompressed, ps, opts, 0&)
''' If res <> AVIERR_OK Then Print 111 'GoTo Error
res = AVIStreamSetFormat(psCompressed, 0, ByVal bminfo, 80000)
''' If (res <> AVIERR_OK) Then Print 111 'GoTo Error
'Delay (0.1)
'keybd_event Chr$(38), 0, 0, 0
'Delay (0.1)
'keybd_event Chr$(38), 0, KEYEVENTF_KEYUP, 0
' addch0 = AC6610_AD(hd6610, 0, gain)' v0 = (addch0 - 2048) * 5000# / 2048#
Do While bStart
Status = HVSnapShot(hhv, VarPtr(ppBuf(0)), 1)
HV_VERIFY (Status)
If (HV_SUCCESS(Status)) Then
ConvertBayer2Rgb VarPtr(pImageBuffer(0)), VarPtr(pRawBuffer(0)), Hv_Width, HV_Height, BAYER2RGB_NEIGHBOUR, VarPtr(pLutR(0)), VarPtr(pLutG(0)), VarPtr(pLutB(0)), True, BAYER_GR
res = AVIStreamWrite(psCompressed, _
i1, _
1, _
VarPtr(pImageBuffer(0)), _
100 * 100 * 3, _
AVIIF_KEYFRAME, _
ByVal 0&, _
ByVal 0&)
'在视图客户区显示图像
StretchDIBits Form1.hdc, 0, 0, Hv_Width, HV_Height, 0, 0, Hv_Width, HV_Height, pImageBuffer(0), bminfo, DIB_RGB_COLORS, SRCCOPY
End If
DoEvents
i1 = i1 + 1
'''End If
Loop
'Now close the file
''' Set file = Nothing
''' Set bmp = Nothing
Call AVIStreamClose(ps) Call AVIStreamClose(psCompressed)
Call AVIFileClose(pfile) Call AVIFileExitEnd Sub