未找到方法或数据成员解决办法
未找到方法或数据成员
我想窗体的"暂停"按钮定义一个对话框,也就是是否将已经获得的屏幕图片1合称为视频文件。但是我调用窗体fMain中的cmdWriteAvi_Click时,老是出现编译错误:“未找到方法或数据成员”。还请各位大虾指点迷津。
///////////////////////////////////////////////////////
Private Sub CommandPause_Click()
Dim Msg, Style, title, Ctxt, Response, MyString
Dim photonumber As Integer
Static bool As Integer
bool = bool * 1
Msg = "是否要将现在截的图片制作成视频文件 ?" ' 定义信息。
Style = vbYesNo + vbCritical + vbDefaultButton2 ' 定义按钮。
title = "MsgBox Demonstration" ' 定义标题。
Ctxt = 1000 ' 定义标题
Response = MsgBox(Msg, Style, title, 0, Ctxt)
If bool = 0 Then
Timer1.Enabled = False
bool = 1
If Response = vbYes Then
Load fMain
fMain.Show
File1.Path = App.Path & "\截图"
File1.Refresh
For i = 0 To File1.ListCount - 1
fMain.lstDIBList.AddItem App.Path & "\截图\" & File1.List(i)
Next
fMain.cmdWriteAVI_Click '///////////////就是在这个地方报错!!!
Unload fMain
Set fMain = Nothing
End If
Else
Timer1.Enabled = True
bool = 0
End If
End Sub
///////////////////////////////////////////////////////
Private Sub cmdWriteAVI_Click()
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 BITMAPINFOHEADER
Dim opts As AVI_COMPRESS_OPTIONS
Dim pOpts As Long
Dim i As Long
Debug.Print
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
szOutputAVIFile = "MyAVI.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 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 = mmioStringToFOURCC("vids", 0&) '// stream type video
.fccHandler = 0& '// default AVI handler
.dwScale = 1
.dwRate = Val(txtFPS) '// fps
.dwSuggestedBufferSize = bmp.SizeImage '// size of one frame pixels
Call SetRect(.rcFrame, 0, 0, bmp.Width, bmp.Height) '// rectangle for stream
我想窗体的"暂停"按钮定义一个对话框,也就是是否将已经获得的屏幕图片1合称为视频文件。但是我调用窗体fMain中的cmdWriteAvi_Click时,老是出现编译错误:“未找到方法或数据成员”。还请各位大虾指点迷津。
///////////////////////////////////////////////////////
Private Sub CommandPause_Click()
Dim Msg, Style, title, Ctxt, Response, MyString
Dim photonumber As Integer
Static bool As Integer
bool = bool * 1
Msg = "是否要将现在截的图片制作成视频文件 ?" ' 定义信息。
Style = vbYesNo + vbCritical + vbDefaultButton2 ' 定义按钮。
title = "MsgBox Demonstration" ' 定义标题。
Ctxt = 1000 ' 定义标题
Response = MsgBox(Msg, Style, title, 0, Ctxt)
If bool = 0 Then
Timer1.Enabled = False
bool = 1
If Response = vbYes Then
Load fMain
fMain.Show
File1.Path = App.Path & "\截图"
File1.Refresh
For i = 0 To File1.ListCount - 1
fMain.lstDIBList.AddItem App.Path & "\截图\" & File1.List(i)
Next
fMain.cmdWriteAVI_Click '///////////////就是在这个地方报错!!!
Unload fMain
Set fMain = Nothing
End If
Else
Timer1.Enabled = True
bool = 0
End If
End Sub
///////////////////////////////////////////////////////
Private Sub cmdWriteAVI_Click()
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 BITMAPINFOHEADER
Dim opts As AVI_COMPRESS_OPTIONS
Dim pOpts As Long
Dim i As Long
Debug.Print
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
szOutputAVIFile = "MyAVI.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 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 = mmioStringToFOURCC("vids", 0&) '// stream type video
.fccHandler = 0& '// default AVI handler
.dwScale = 1
.dwRate = Val(txtFPS) '// fps
.dwSuggestedBufferSize = bmp.SizeImage '// size of one frame pixels
Call SetRect(.rcFrame, 0, 0, bmp.Width, bmp.Height) '// rectangle for stream