
求VB高手,解答一下啥意思。
PrivateSubexit_Click()'onlyifrunning...If(Timer1.Enabled)ThenTimer1.Enabled=False'Sto...
Private Sub exit_Click()
' only if running...
If (Timer1.Enabled) Then
Timer1.Enabled = False 'Stop Timer
VideoOCX.Stop
VideoOCX.Close
End If
End
End Sub
Private Sub Start_Click() 'Init VideoOCX Control, allocate memory and start grabbing
If (Not Timer1.Enabled) Then
Start.Caption = "Stop"
' Disable internal error messages in VideoOCX
VideoOCX.SetErrorMessages False
' Init control
If (Not VideoOCX.Init) Then
' Init failed. Display error message and end sub
MsgBox VideoOCX.GetLastErrorString, vbOKOnly, "VideoOCX Error"
End
Else
' Allocate memory for global image handle
capture_image = VideoOCX.GetColorImageHandle
' result_image = VideoOCX_Processed.GetColorImageHandle
Timer1.Enabled = True 'Start capture timer
' Start Capture mode
If (Not VideoOCX.Start) Then
' Start failed. Display error message and end sub
MsgBox VideoOCX.GetLastErrorString, vbOKOnly, "VideoOCX Error"
End
End If
End If
Else
Start.Caption = "Start"
Timer1.Enabled = False 'Stop Timer
VideoOCX.Stop
VideoOCX.Close
End If
End Sub
Private Sub Timer1_Timer()
' Timer for capturing - handles videoOCXTools
Dim matrix As Variant
Dim height, width As Integer
Dim r, c As Integer
Dim max_r, max_c As Integer
Dim max_red As Integer
Dim gain, offset As Variant
Dim h_cm As Variant
Dim range As Integer
Dim pixels_from_center As Integer
' Calibrated parameter for pixel to distance conversion
gain = 0.0024259348
offset = -0.056514344
h_cm = 5.842
max_red = 0
' Capture an image
If (VideoOCX.Capture(capture_image)) Then
' VideoOCX.Show capture_image
' Matrix transformation initialization
matrix = VideoOCX.GetMatrix(capture_image)
height = VideoOCX.GetHeight
width = VideoOCX.GetWidth
' Image processing code 展开
' only if running...
If (Timer1.Enabled) Then
Timer1.Enabled = False 'Stop Timer
VideoOCX.Stop
VideoOCX.Close
End If
End
End Sub
Private Sub Start_Click() 'Init VideoOCX Control, allocate memory and start grabbing
If (Not Timer1.Enabled) Then
Start.Caption = "Stop"
' Disable internal error messages in VideoOCX
VideoOCX.SetErrorMessages False
' Init control
If (Not VideoOCX.Init) Then
' Init failed. Display error message and end sub
MsgBox VideoOCX.GetLastErrorString, vbOKOnly, "VideoOCX Error"
End
Else
' Allocate memory for global image handle
capture_image = VideoOCX.GetColorImageHandle
' result_image = VideoOCX_Processed.GetColorImageHandle
Timer1.Enabled = True 'Start capture timer
' Start Capture mode
If (Not VideoOCX.Start) Then
' Start failed. Display error message and end sub
MsgBox VideoOCX.GetLastErrorString, vbOKOnly, "VideoOCX Error"
End
End If
End If
Else
Start.Caption = "Start"
Timer1.Enabled = False 'Stop Timer
VideoOCX.Stop
VideoOCX.Close
End If
End Sub
Private Sub Timer1_Timer()
' Timer for capturing - handles videoOCXTools
Dim matrix As Variant
Dim height, width As Integer
Dim r, c As Integer
Dim max_r, max_c As Integer
Dim max_red As Integer
Dim gain, offset As Variant
Dim h_cm As Variant
Dim range As Integer
Dim pixels_from_center As Integer
' Calibrated parameter for pixel to distance conversion
gain = 0.0024259348
offset = -0.056514344
h_cm = 5.842
max_red = 0
' Capture an image
If (VideoOCX.Capture(capture_image)) Then
' VideoOCX.Show capture_image
' Matrix transformation initialization
matrix = VideoOCX.GetMatrix(capture_image)
height = VideoOCX.GetHeight
width = VideoOCX.GetWidth
' Image processing code 展开
展开全部
Private Sub exit_Click() exit按钮单击事件
' only if running...
If (Timer1.Enabled) Then 条件语句“假如时间控件处于活动状态时执行 if ...then 和 end if 之间的语句
Timer1.Enabled = False 时间控件失去焦点,停止计时
VideoOCX.stop 停止播放
VideoOCX.Close 关闭播放设备
End If
End
End Sub
Private Sub Start_Click() 'Init VideoOCX Control, allocate memory and start grabbing 注释同上
If (Not Timer1.Enabled) Then
Start.Caption = "Stop" 设置按钮名称
' Disable internal error messages in VideoOCX
VideoOCX.SetErrorMessages False
' Init control
If (Not VideoOCX.Init) Then
' Init failed. Display error message and end sub
MsgBox VideoOCX.GetLastErrorString, vbOKOnly, "VideoOCX Error" 弹出信息窗口
End
Else
' Allocate memory for global image handle
capture_image = VideoOCX.GetColorImageHandle
' result_image = VideoOCX_Processed.GetColorImageHandle
Timer1.Enabled = True 'Start capture timer
' Start Capture mode
If (Not VideoOCX.Start) Then
' Start failed. Display error message and end sub
MsgBox VideoOCX.GetLastErrorString, vbOKOnly, "VideoOCX Error"
End
End If
End If
Else
Start.Caption = "Start"
Timer1.Enabled = False 'Stop Timer
VideoOCX.Stop
VideoOCX.Close
End If
End Sub
Private Sub Timer1_Timer()
' Timer for capturing - handles videoOCXTools
Dim matrix As Variant
Dim height, width As Integer
Dim r, c As Integer
Dim max_r, max_c As Integer
Dim max_red As Integer
Dim gain, offset As Variant
Dim h_cm As Variant
Dim range As Integer
Dim pixels_from_center As Integer
' only if running...
If (Timer1.Enabled) Then 条件语句“假如时间控件处于活动状态时执行 if ...then 和 end if 之间的语句
Timer1.Enabled = False 时间控件失去焦点,停止计时
VideoOCX.stop 停止播放
VideoOCX.Close 关闭播放设备
End If
End
End Sub
Private Sub Start_Click() 'Init VideoOCX Control, allocate memory and start grabbing 注释同上
If (Not Timer1.Enabled) Then
Start.Caption = "Stop" 设置按钮名称
' Disable internal error messages in VideoOCX
VideoOCX.SetErrorMessages False
' Init control
If (Not VideoOCX.Init) Then
' Init failed. Display error message and end sub
MsgBox VideoOCX.GetLastErrorString, vbOKOnly, "VideoOCX Error" 弹出信息窗口
End
Else
' Allocate memory for global image handle
capture_image = VideoOCX.GetColorImageHandle
' result_image = VideoOCX_Processed.GetColorImageHandle
Timer1.Enabled = True 'Start capture timer
' Start Capture mode
If (Not VideoOCX.Start) Then
' Start failed. Display error message and end sub
MsgBox VideoOCX.GetLastErrorString, vbOKOnly, "VideoOCX Error"
End
End If
End If
Else
Start.Caption = "Start"
Timer1.Enabled = False 'Stop Timer
VideoOCX.Stop
VideoOCX.Close
End If
End Sub
Private Sub Timer1_Timer()
' Timer for capturing - handles videoOCXTools
Dim matrix As Variant
Dim height, width As Integer
Dim r, c As Integer
Dim max_r, max_c As Integer
Dim max_red As Integer
Dim gain, offset As Variant
Dim h_cm As Variant
Dim range As Integer
Dim pixels_from_center As Integer
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询