home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
- Object = "{00100023-B1BA-11CE-ABC6-F5B2E79D9E3F}#1.0#0"; "LTCAP10N.OCX"
- Begin VB.Form MainForm
- BorderStyle = 3 'Fixed Dialog
- Caption = "LEADTOOLS VB Capture Demo"
- ClientHeight = 3870
- ClientLeft = 555
- ClientTop = 1725
- ClientWidth = 6210
- Icon = "MainForm.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 3870
- ScaleWidth = 6210
- ShowInTaskbar = 0 'False
- Begin LEADCapLibCtl.LEADCap LEADCap1
- Height = 375
- Left = 3360
- OleObjectBlob = "MainForm.frx":030A
- TabIndex = 25
- Top = 2400
- Width = 495
- End
- Begin VB.CommandButton Command4
- Caption = "About..."
- Height = 420
- Left = 4440
- TabIndex = 27
- Top = 3015
- Width = 855
- End
- Begin VB.CommandButton Command3
- Caption = "Save As..."
- Height = 420
- Left = 3120
- TabIndex = 26
- Top = 3015
- Width = 990
- End
- Begin VB.CommandButton Command2
- Caption = "Capture Info"
- Height = 420
- Left = 2040
- TabIndex = 24
- Top = 3015
- Width = 990
- End
- Begin VB.TextBox Status
- BackColor = &H80000004&
- Enabled = 0 'False
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 300
- Left = 0
- TabIndex = 20
- Top = 3510
- Width = 6210
- End
- Begin VB.CommandButton CloseBtn
- Caption = "Close"
- Height = 420
- Left = 5400
- TabIndex = 19
- Top = 3015
- Width = 750
- End
- Begin VB.Frame Frame2
- Caption = "Capture Options"
- Height = 2715
- Left = 3480
- TabIndex = 13
- Top = 180
- Width = 2625
- Begin VB.ComboBox AudioFormat
- Height = 315
- ItemData = "MainForm.frx":0344
- Left = 135
- List = "MainForm.frx":036C
- Style = 2 'Dropdown List
- TabIndex = 23
- Top = 1275
- Width = 2430
- End
- Begin VB.OptionButton DisplayOptions
- Caption = "Overlay"
- Height = 225
- Index = 1
- Left = 1470
- TabIndex = 22
- Top = 1815
- Width = 885
- End
- Begin VB.OptionButton DisplayOptions
- Caption = "Preview"
- Height = 225
- Index = 0
- Left = 150
- TabIndex = 21
- Top = 1800
- Value = -1 'True
- Width = 960
- End
- Begin VB.CheckBox CaptureAudio
- Caption = "Capture Audio"
- Height = 225
- Left = 150
- TabIndex = 18
- Top = 1005
- Value = 1 'Checked
- Width = 1455
- End
- Begin VB.TextBox FramesPS
- Height = 285
- Left = 1545
- TabIndex = 16
- Text = "0"
- Top = 180
- Width = 810
- End
- Begin VB.CheckBox TimeCheck
- Caption = "Time Limit"
- Height = 240
- Left = 150
- TabIndex = 15
- Top = 675
- Width = 1050
- End
- Begin VB.TextBox TimeLimit
- Enabled = 0 'False
- Height = 285
- Left = 1545
- TabIndex = 14
- Text = "0"
- Top = 600
- Width = 810
- End
- Begin VB.Line Line1
- X1 = 0
- X2 = 2595
- Y1 = 1695
- Y2 = 1695
- End
- Begin VB.Label Label4
- Caption = "Frames Per Sec"
- Height = 180
- Left = 150
- TabIndex = 17
- Top = 270
- Width = 1185
- End
- End
- Begin VB.Frame Dialogs
- Caption = "Dialogs"
- Height = 885
- Left = 30
- TabIndex = 9
- Top = 630
- Width = 3270
- Begin VB.CommandButton FormatBtn
- Caption = "&Format"
- Height = 405
- Left = 195
- TabIndex = 12
- Top = 270
- Width = 900
- End
- Begin VB.CommandButton SourceBtn
- Caption = "&Source"
- Height = 405
- Left = 1995
- TabIndex = 11
- Top = 270
- Width = 900
- End
- Begin VB.CommandButton DisplayBtn
- Caption = "&Display"
- Height = 405
- Left = 1095
- TabIndex = 10
- Top = 270
- Width = 900
- End
- End
- Begin VB.CommandButton StopBtn
- Caption = "Stop"
- Height = 420
- Left = 1080
- TabIndex = 8
- Top = 3015
- Width = 870
- End
- Begin VB.CommandButton StartBtn
- Caption = "Start"
- Height = 420
- Left = 75
- TabIndex = 7
- Top = 3015
- Width = 900
- End
- Begin VB.ComboBox DriverCombo
- Height = 315
- Left = 30
- Style = 2 'Dropdown List
- TabIndex = 6
- Top = 270
- Width = 3255
- End
- Begin VB.Frame Frame1
- Caption = "Capture File"
- Height = 1335
- Left = 45
- TabIndex = 0
- Top = 1545
- Width = 3255
- Begin VB.CommandButton Command1
- Caption = "..."
- Height = 255
- Left = 2760
- TabIndex = 4
- Top = 510
- Width = 255
- End
- Begin VB.TextBox WorkFileSize
- Height = 285
- Left = 840
- TabIndex = 3
- Top = 840
- Width = 1815
- End
- Begin VB.Label CapFile
- BackColor = &H8000000A&
- Caption = "Label5"
- Height = 255
- Left = 120
- TabIndex = 28
- Top = 510
- Width = 2535
- End
- Begin VB.Label Label2
- Caption = "File Size:"
- Height = 255
- Left = 120
- TabIndex = 2
- Top = 870
- Width = 1215
- End
- Begin VB.Label Label1
- Caption = "Filename:"
- Height = 255
- Left = 120
- TabIndex = 1
- Top = 240
- Width = 1095
- End
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 3360
- Top = 1800
- _ExtentX = 847
- _ExtentY = 847
- _Version = 327681
- CancelError = -1 'True
- DefaultExt = "avi"
- DialogTitle = "Capture Work File"
- Filter = "AVI File | *.avi|"
- End
- Begin VB.Label Label3
- Caption = "Capture Drivers:"
- Height = 255
- Left = 30
- TabIndex = 5
- Top = 30
- Width = 1575
- End
- Attribute VB_Name = "MainForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Dim ActiveIndex As Integer
- Sub EnableButtons()
- Dim i As Long
- FormatBtn.Enabled = CaptureForm.LEADCap1.IsOptionAvailable(DLG_VIDFORMAT)
- SourceBtn.Enabled = CaptureForm.LEADCap1.IsOptionAvailable(DLG_VIDSOURCE)
- DisplayBtn.Enabled = CaptureForm.LEADCap1.IsOptionAvailable(DLG_VIDDISPLAY)
- DisplayOptions(1).Enabled = CaptureForm.LEADCap1.IsOptionAvailable(DLG_VIDDISPLAY)
- End Sub
- Private Sub AudioFormat_Click()
- On Error GoTo TheError
- Select Case AudioFormat.ListIndex
- Case 0
- CaptureForm.LEADCap1.CapAudioFormat(CAP_AUDIO_CAPTURE) = FILE_WAV_1M08
- Case 1
- CaptureForm.LEADCap1.CapAudioFormat(CAP_AUDIO_CAPTURE) = FILE_WAV_1S08
- Case 2
- CaptureForm.LEADCap1.CapAudioFormat(CAP_AUDIO_CAPTURE) = FILE_WAV_1M16
- Case 3
- CaptureForm.LEADCap1.CapAudioFormat(CAP_AUDIO_CAPTURE) = FILE_WAV_1S16
- Case 4
- CaptureForm.LEADCap1.CapAudioFormat(CAP_AUDIO_CAPTURE) = FILE_WAV_2M08
- Case 5
- CaptureForm.LEADCap1.CapAudioFormat(CAP_AUDIO_CAPTURE) = FILE_WAV_2S08
- Case 6
- CaptureForm.LEADCap1.CapAudioFormat(CAP_AUDIO_CAPTURE) = FILE_WAV_2M16
- Case 7
- CaptureForm.LEADCap1.CapAudioFormat(CAP_AUDIO_CAPTURE) = FILE_WAV_2S16
- Case 8
- CaptureForm.LEADCap1.CapAudioFormat(CAP_AUDIO_CAPTURE) = FILE_WAV_4M08
- Case 9
- CaptureForm.LEADCap1.CapAudioFormat(CAP_AUDIO_CAPTURE) = FILE_WAV_4S08
- Case 10
- CaptureForm.LEADCap1.CapAudioFormat(CAP_AUDIO_CAPTURE) = FILE_WAV_4M16
- Case 11
- CaptureForm.LEADCap1.CapAudioFormat(CAP_AUDIO_CAPTURE) = FILE_WAV_4S16
- End Select
- Exit Sub
- TheError:
- MsgBox CStr(Err.Description)
- End Sub
- Private Sub CaptureAudio_Click()
- CaptureForm.LEADCap1.CapCaptureAudio = (CaptureAudio.Value = 1)
- AudioFormat.Enabled = CaptureForm.LEADCap1.CapCaptureAudio
- End Sub
- Private Sub Check1_Click()
- TimeLimit.Enabled = (Check1.Value = 1)
- If TimeLimit.Enabled Then
- CaptureForm.LEADCap1.CapTimeLimit = Str(TimeLimit.Text)
- Else
- CaptureForm.LEADCap1.CapTimeLimit = 0
- End If
- End Sub
- Private Sub Command2_Click()
- ' you shouldn't display a dialog during a capture operation, If you stop and display
- ' your dialog right away the info reported may not be totally accurate, because of buffered
- ' data, you should wait for some to for the data to be written
- CaptureForm.LEADCap1.CapStopCapture
- CapInfoForm.Show 1
- End Sub
- Private Sub Command3_Click()
- On Error GoTo TheError
- 'save the workfile to a permanent file
- CommonDialog1.Filter = "AVI files|*.avi"
- CommonDialog1.DefaultExt = ".avi"
- CommonDialog1.ShowSave
- If CommonDialog1.filename <> "" Then
- Screen.MousePointer = 11
- nRet = CaptureForm.LEADCap1.CapCopyWorkFileAs(CommonDialog1.filename)
- Screen.MousePointer = 0
- If nRet <> 0 Then
- MsgBox "Error saving file!"
- End If
- End If
- Exit Sub
- TheError:
- MsgBox CStr(Err.Description)
- End Sub
- Private Sub Command4_Click()
- ' CaptureForm.LeadCap1.CapUpdateVidFormat
- Dim Msg$
- Msg$ = "LEADTOOLS VB Capture Demo"
- Msg$ = Msg$ & Chr$(13)
- Msg$ = Msg$ & "Copyright 1998, LEAD Technolgies, Inc."
- Msg$ = Msg$ & Chr$(13)
- Msg$ = Msg$ & Chr$(13)
- Msg$ = Msg$ & "phone: 800-637-4699"
- Msg$ = Msg$ & Chr$(13)
- Msg$ = Msg$ & "http://www.leadtools.com"
- Msg$ = Msg$ & Chr$(13)
- Msg$ = Msg$ & "e-mail: support@leadtools.com"
- MsgBox Msg$
- End Sub
- Private Sub CloseBtn_Click()
- End
- End Sub
- Private Sub Command1_Click()
- On Error GoTo GetOut
- CommonDialog1.filename = CapFile.Caption
- CommonDialog1.ShowSave
- CaptureForm.LEADCap1.CapWorkFile = CommonDialog1.filename
- CapFile.Caption = CommonDialog1.filename
- GetOut:
- Exit Sub
- End Sub
- Private Sub DisplayBtn_Click()
- CaptureForm.LEADCap1.CapDisplayDialog DLG_VIDDISPLAY, CAP_AUDIO_CAPTURE, CAP_AUDIO_CHOOSE_INPUT + CAP_AUDIO_CHOOSE_OUTPUT
- End Sub
- Private Sub DisplayOptions_Click(Index As Integer)
- If DisplayOptions(Index).Value = True And Index = 0 Then
- CaptureForm.LEADCap1.CapDisplayMode = DISPLAY_PREVIEW
- ElseIf DisplayOptions(Index).Value = True And Index = 1 Then
- CaptureForm.LEADCap1.CapDisplayMode = DISPLAY_OVERLAY
- End If
- End Sub
- Private Sub DriverCombo_Click()
- If ActiveIndex <> DriverCombo.ListIndex Then
- ActiveIndex = DriverCombo.ListIndex
- CaptureForm.LEADCap1.CapDisconnect
- CaptureForm.LEADCap1.CapConnect ActiveIndex
- EnableButtons
- End If
- End Sub
- Private Sub Form_Load()
- LEADCap1.UnlockSupport L_SUPPORT_EXPRESS, L_KEY_EXPRESS
- LEADCap1.UnlockSupport L_SUPPORT_VIDEO, L_KEY_VIDEO
- LEADCap1.Visible = False
- CaptureForm.LEADCap1.AutoResizeControl = True
- LEADCap1.CapEnumDrivers
- CapFile.Caption = CaptureForm.LEADCap1.CapWorkFile
- CaptureForm.LEADCap1.EnableMethodErrors = False
- If DriverCombo.ListCount > 0 Then
- DriverCombo.ListIndex = 0
- nRet = CaptureForm.LEADCap1.CapConnect(DriverCombo.ListIndex)
- If (nRet <> 0) Then
- MsgBox "Error connecting to capture driver: " & DriverCombo.List(DriverCombo.ListIndex) & Chr$(13) & "Ending Application!"
- End
- End If
- Else
- DriverCombo.Enabled = False
- End If
- CaptureForm.LEADCap1.EnableMethodErrors = True
- CaptureForm.LEADCap1.CapDisplayMode = DISPLAY_PREVIEW
- FramesPS.Text = CStr(CaptureForm.LEADCap1.CapFramesPerSec)
- EnableButtons
- CaptureForm.Left = Left + Width
- CaptureForm.Top = Top
- CaptureForm.LEADCap1.EnableCaptureStatus = True
- WorkFileSize.Text = CStr(CaptureForm.LEADCap1.CapWorkFileSize)
- AudioFormat.ListIndex = 0
- ActiveIndex = 0
- CaptureForm.Show
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Unload CaptureForm
- End Sub
- Private Sub FormatBtn_Click()
- CaptureForm.LEADCap1.CapDisplayDialog DLG_VIDFORMAT, 0, 0
- End Sub
- Private Sub LeadCap1_CapDriver(ByVal iDriver As Integer, ByVal pszName As String)
- DriverCombo.AddItem pszName, iDriver
- End Sub
- Private Sub SourceBtn_Click()
- CaptureForm.LEADCap1.CapDisplayDialog DLG_VIDSOURCE, 0, 0
- End Sub
- Private Sub StartBtn_Click()
- On Error GoTo STARTERROR
- CaptureForm.LEADCap1.CapAbortLeftMouse = False
- CaptureForm.LEADCap1.CapAbortRightMouse = True
- CaptureForm.LEADCap1.CapStartCapture
- Exit Sub
- STARTERROR:
- MsgBox Err.Description
- End Sub
- Private Sub StopBtn_Click()
- On Error GoTo STOPERROR
- CaptureForm.LEADCap1.CapStopCapture
- Exit Sub
- STOPERROR:
- MsgBox Err.Description
- End Sub
- Private Sub Text2_Change()
- CaptureForm.LEADCap1.CapWorkFileSize = Val(Text2.Text)
- End Sub
- Private Sub TimeCheck_Click()
- TimeLimit.Enabled = (TimeCheck.Value = 1)
- If Not TimeLimit.Enabled Then
- CaptureForm.LEADCap1.CapTimeLimit = 0
- End If
- End Sub
- Private Sub TimeLimit_Change()
- If TimeCheck.Value = 1 Then
- CaptureForm.LEADCap1.CapTimeLimit = Val(TimeLimit.Text)
- End If
- End Sub
- Private Sub WorkFileSize_Change()
- CaptureForm.LEADCap1.CapWorkFileSize = Val(WorkFileSize.Text)
- End Sub
-