www.pudn.com > sdk3000demo.rar > CaptureSet.frm, change:2009-07-04,size:8370b


VERSION 5.00 
Begin VB.Form formCaptureSet  
   Caption         =   "捕获参数设置" 
   ClientHeight    =   4680 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   7935 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   4680 
   ScaleWidth      =   7935 
   StartUpPosition =   3  'Windows Default 
   Begin VB.CheckBox checkAudio  
      Caption         =   "录制音频" 
      Height          =   375 
      Left            =   3720 
      TabIndex        =   17 
      Top             =   2040 
      Width           =   1335 
   End 
   Begin VB.ComboBox comboCapSize  
      Height          =   315 
      ItemData        =   "CaptureSet.frx":0000 
      Left            =   1920 
      List            =   "CaptureSet.frx":0031 
      Style           =   2  'Dropdown List 
      TabIndex        =   0 
      Top             =   840 
      Width           =   3135 
   End 
   Begin VB.CommandButton btnBrowseVideo  
      Caption         =   "浏览..." 
      Height          =   375 
      Left            =   5160 
      TabIndex        =   4 
      Top             =   2640 
      Width           =   735 
   End 
   Begin VB.CommandButton btnBrowsePicture  
      Caption         =   "浏览..." 
      Height          =   375 
      Left            =   5160 
      TabIndex        =   6 
      Top             =   3240 
      Width           =   735 
   End 
   Begin VB.TextBox editVideoPath  
      Enabled         =   0   'False 
      Height          =   285 
      Left            =   1920 
      TabIndex        =   3 
      Text            =   "e:\Video\" 
      Top             =   2640 
      Width           =   3135 
   End 
   Begin VB.TextBox editPicturePath  
      Enabled         =   0   'False 
      Height          =   285 
      Left            =   1920 
      TabIndex        =   5 
      Text            =   "e:\Picture\" 
      Top             =   3240 
      Width           =   3135 
   End 
   Begin VB.TextBox editFrameRate  
      Height          =   285 
      Left            =   1920 
      TabIndex        =   16 
      Text            =   "3" 
      Top             =   2040 
      Width           =   855 
   End 
   Begin VB.ComboBox comboVideoComp  
      Height          =   315 
      Left            =   1920 
      Style           =   2  'Dropdown List 
      TabIndex        =   1 
      Top             =   1440 
      Width           =   3135 
   End 
   Begin VB.CommandButton btnCancel  
      Caption         =   "取消" 
      Height          =   375 
      Left            =   6240 
      TabIndex        =   10 
      Top             =   840 
      Width           =   1335 
   End 
   Begin VB.CommandButton btnOk  
      Caption         =   "确定" 
      Height          =   375 
      Left            =   6240 
      TabIndex        =   9 
      Top             =   240 
      Width           =   1335 
   End 
   Begin VB.OptionButton radioBmp  
      Caption         =   "BMP 格式" 
      Height          =   255 
      Left            =   3480 
      TabIndex        =   8 
      Top             =   3840 
      Width           =   1095 
   End 
   Begin VB.OptionButton radioJpg  
      Caption         =   "JPG 格式" 
      Height          =   255 
      Left            =   1920 
      TabIndex        =   7 
      Top             =   3840 
      Value           =   -1  'True 
      Width           =   1095 
   End 
   Begin VB.Label Label8  
      Caption         =   "捕获帧率:" 
      Height          =   255 
      Left            =   480 
      TabIndex        =   15 
      Top             =   2040 
      Width           =   1335 
   End 
   Begin VB.Label Label7  
      Caption         =   "捕获文件路径:" 
      Height          =   255 
      Left            =   480 
      TabIndex        =   14 
      Top             =   2640 
      Width           =   1335 
   End 
   Begin VB.Label Label6  
      Caption         =   "图片抓拍路径:" 
      Height          =   255 
      Left            =   480 
      TabIndex        =   13 
      Top             =   3240 
      Width           =   1335 
   End 
   Begin VB.Label Label3  
      Caption         =   "压缩格式:" 
      Height          =   255 
      Left            =   480 
      TabIndex        =   12 
      Top             =   1440 
      Width           =   1335 
   End 
   Begin VB.Label Label2  
      Caption         =   "视频尺寸大小:" 
      Height          =   255 
      Left            =   480 
      TabIndex        =   11 
      Top             =   840 
      Width           =   1335 
   End 
   Begin VB.Label Label1  
      Caption         =   "图片抓拍格式:" 
      Height          =   255 
      Left            =   480 
      TabIndex        =   2 
      Top             =   3840 
      Width           =   1335 
   End 
End 
Attribute VB_Name = "formCaptureSet" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
'Download by http://www.codefans.net 
Private Sub btnBrowsePicture_Click() 
 
    Dim strResFolder As String 
    strResFolder = BrowseForFolder(hwnd, "请选择一个目录.") 
    If strResFolder <> "" Then 
        Dim strLast As String 
        strLast = Right(strResFolder, 1) 
        If strLast <> "\" Then 
            editPicturePath.Text = strResFolder + "\" 
        Else 
            editPicturePath.Text = strResFolder 
        End If 
    End If 
     
End Sub 
 
Private Sub btnBrowseVideo_Click() 
 
    Dim strResFolder As String 
    strResFolder = BrowseForFolder(hwnd, "请选择一个目录.") 
    If strResFolder <> "" Then 
        Dim strLast As String 
        strLast = Right(strResFolder, 1) 
        If strLast <> "\" Then 
            editVideoPath.Text = strResFolder + "\" 
        Else 
            editVideoPath.Text = strResFolder 
        End If 
    End If 
 
End Sub 
 
Private Sub btnCancel_Click() 
 
    Call Unload(Me) 
     
End Sub 
 
Private Sub btnOk_Click() 
 
    '判断视频尺寸是否变化 
    Dim nNewWidth As Long 
    Dim nNewHeight As Long 
     
    nNewWidth = CLng(Left(comboCapSize.Text, 3)) 
    nNewHeight = CLng(Right(comboCapSize.Text, 3)) 
     
    If nNewWidth <> g_nCapWidth Or nNewHeight <> g_nCapHeight Then 
        g_nCapWidth = nNewWidth 
        g_nCapHeight = nNewHeight 
     
        If g_bConnected Then 
            Call formMain.SDK30001.Disconnect 
        End If 
     
        Call formMain.SDK30001.Connect(0, True, g_nCapWidth, g_nCapHeight) 
    End If 
     
    '取得帧率 
    formMain.SDK30001.FrameRate = CLng(editFrameRate.Text) 
     
    '更新全局变量 
    g_strVideoPath = editVideoPath.Text 
    g_strPicturePath = editPicturePath.Text 
    g_nCurComp = comboVideoComp.ListIndex 
     
    If radioJpg.Value Then 
        g_bBmp = False 
    Else 
        g_bBmp = True 
    End If 
     
    If checkAudio.Value = Checked Then 
        g_bRecAudio = True 
         
        Dim nAudioDev As Long 
        formMain.SDK30001.GetAudioCaptureDevCount nAudioDev 
        If nAudioDev > 0 Then 
            formMain.SDK30001.SetCurrentAudioCompressorNum 0 
        End If 
    Else 
     
        g_bRecAudio = False 
        formMain.SDK30001.SetCurrentAudioCompressorNum -1 
    End If 
     
    '关闭窗体 
    Call Unload(Me) 
     
End Sub 
 
Private Sub Form_Load() 
 
    comboCapSize.Text = CStr(g_nCapWidth) + " * " + CStr(g_nCapHeight) 
    editFrameRate.Text = CStr(formMain.SDK30001.FrameRate) 
    editVideoPath.Text = g_strVideoPath 
    editPicturePath.Text = g_strPicturePath 
     
    If g_bRecAudio Then 
        checkAudio.Value = Checked 
    Else 
        checkAudio.Value = Unchecked 
    End If 
     
    '取得所有压缩算法 
    Dim bRet As Boolean 
    Dim nCompNum As Long 
    Dim nCurComp As Long 
    Dim strCom As String 
    Dim i As Long 
    Dim nXvid As Long 
     
    bRet = formMain.SDK30001.GetVideoCompressorCount(nCompNum) 
     
    For i = 0 To nCompNum - 1 
        bRet = formMain.SDK30001.GetOneVideoCompressor(i, strCom) 
             
        If g_nCurComp = -1 And strCom = "XviD MPEG-4 Codec" Then 
            g_nCurComp = i 
        End If 
            
        comboVideoComp.AddItem (strCom) 
    Next i 
     
    If g_nCurComp = -1 Then 
        g_nCurComp = 0 
    End If 
     
    comboVideoComp.ListIndex = g_nCurComp 
     
End Sub