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


VERSION 5.00 
Begin VB.Form formCapPic  
   Caption         =   "循环抓拍" 
   ClientHeight    =   4860 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   7260 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   4860 
   ScaleWidth      =   7260 
   StartUpPosition =   3  'Windows Default 
   Begin VB.TextBox editInterval  
      Height          =   375 
      Left            =   5520 
      TabIndex        =   19 
      Text            =   "5" 
      Top             =   2520 
      Width           =   975 
   End 
   Begin VB.CommandButton btnExit  
      Caption         =   "退出" 
      Height          =   495 
      Left            =   5160 
      TabIndex        =   18 
      Top             =   1080 
      Width           =   1815 
   End 
   Begin VB.CommandButton btnStart  
      Caption         =   "开始抓拍" 
      Height          =   495 
      Left            =   5160 
      TabIndex        =   17 
      Top             =   480 
      Width           =   1815 
   End 
   Begin VB.Frame Frame4  
      Caption         =   "存盘路径" 
      Height          =   855 
      Left            =   240 
      TabIndex        =   14 
      Top             =   3840 
      Width           =   4335 
      Begin VB.CommandButton btnBrowse  
         Caption         =   "浏览..." 
         Height          =   375 
         Left            =   3000 
         TabIndex        =   16 
         Top             =   360 
         Width           =   975 
      End 
      Begin VB.TextBox editPath  
         Enabled         =   0   'False 
         Height          =   285 
         Left            =   120 
         TabIndex        =   15 
         Text            =   "e:\" 
         Top             =   360 
         Width           =   2655 
      End 
   End 
   Begin VB.Frame Frame3  
      Caption         =   "图片格式" 
      Height          =   1215 
      Left            =   2880 
      TabIndex        =   11 
      Top             =   2400 
      Width           =   1695 
      Begin VB.OptionButton radioBmp  
         Caption         =   "BMP 格式" 
         Height          =   375 
         Left            =   240 
         TabIndex        =   13 
         Top             =   720 
         Width           =   1095 
      End 
      Begin VB.OptionButton radioJpg  
         Caption         =   "JPG 格式" 
         Height          =   375 
         Left            =   240 
         TabIndex        =   12 
         Top             =   360 
         Value           =   -1  'True 
         Width           =   1095 
      End 
   End 
   Begin VB.Frame Frame2  
      Caption         =   "循环拍照" 
      Height          =   1215 
      Left            =   240 
      TabIndex        =   7 
      Top             =   2400 
      Width           =   2175 
      Begin VB.TextBox editTime  
         Height          =   285 
         Left            =   1080 
         TabIndex        =   9 
         Text            =   "2" 
         Top             =   480 
         Width           =   615 
      End 
      Begin VB.Label Label2  
         Caption         =   "秒" 
         Height          =   375 
         Left            =   1800 
         TabIndex        =   10 
         Top             =   480 
         Width           =   255 
      End 
      Begin VB.Label Label1  
         Caption         =   "持续时间:" 
         Height          =   375 
         Left            =   120 
         TabIndex        =   8 
         Top             =   480 
         Width           =   1095 
      End 
   End 
   Begin VB.Frame Frame1  
      Caption         =   "视频源" 
      Height          =   2055 
      Left            =   240 
      TabIndex        =   0 
      Top             =   120 
      Width           =   4335 
      Begin VB.CommandButton btnSelectAll  
         Caption         =   "全选" 
         Height          =   375 
         Left            =   1680 
         TabIndex        =   6 
         Top             =   1440 
         Width           =   855 
      End 
      Begin VB.CheckBox checkSVideo  
         Caption         =   "SVIDEO通道1" 
         Height          =   255 
         Left            =   480 
         TabIndex        =   5 
         Top             =   1080 
         Width           =   1455 
      End 
      Begin VB.CheckBox checkVideo4  
         Caption         =   "VIDEO通道4" 
         Height          =   255 
         Left            =   2520 
         TabIndex        =   4 
         Top             =   720 
         Width           =   1335 
      End 
      Begin VB.CheckBox checkVideo2  
         Caption         =   "VIDEO通道2" 
         Height          =   255 
         Left            =   2520 
         TabIndex        =   2 
         Top             =   360 
         Width           =   1335 
      End 
      Begin VB.CheckBox checkVideo3  
         Caption         =   "VIDEO通道3" 
         Height          =   255 
         Left            =   480 
         TabIndex        =   3 
         Top             =   720 
         Width           =   1335 
      End 
      Begin VB.CheckBox checkVideo1  
         Caption         =   "VIDEO通道1" 
         Height          =   255 
         Left            =   480 
         TabIndex        =   1 
         Top             =   360 
         Width           =   1335 
      End 
   End 
End 
Attribute VB_Name = "formCapPic" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
'Download by http://www.codefans.net 
Public m_nCurVideo As Long 
 
Private Sub btnBrowse_Click() 
 
    Dim strResFolder As String 
    strResFolder = BrowseForFolder(hwnd, "请选择一个目录.") 
    If strResFolder <> "" Then 
        Dim strLast As String 
        strLast = Right(strResFolder, 1) 
        If strLast <> "\" Then 
            editPath.Text = strResFolder + "\" 
        Else 
            editPath.Text = strResFolder 
        End If 
    End If 
 
End Sub 
 
Private Sub btnExit_Click() 
 
    Call formMain.SDK30001.DisableCapSourceStream 
    formMain.SDK30001.VideoSource = m_nCurVideo 
    Call Unload(Me) 
     
End Sub 
 
Private Sub btnSelectAll_Click() 
 
    checkVideo1.Value = Checked 
    checkVideo2.Value = Checked 
    checkVideo3.Value = Checked 
    checkVideo4.Value = Checked 
    checkSVideo.Value = Checked 
     
End Sub 
 
Private Sub btnStart_Click() 
 
    '为各路是否抓拍赋值 
    Dim i As Long 
     
    If checkVideo1.Value = Checked Then 
        g_bCircularSource(0) = True 
    Else 
        g_bCircularSource(0) = False 
    End If 
     
    If checkVideo2.Value = Checked Then 
        g_bCircularSource(1) = True 
    Else 
        g_bCircularSource(1) = False 
    End If 
     
    If checkVideo3.Value = Checked Then 
        g_bCircularSource(2) = True 
    Else 
        g_bCircularSource(2) = False 
    End If 
     
    If checkVideo4.Value = Checked Then 
        g_bCircularSource(3) = True 
    Else 
        g_bCircularSource(3) = False 
    End If 
     
    If checkSVideo.Value = Checked Then 
        g_bCircularSource(4) = True 
    Else 
        g_bCircularSource(4) = False 
    End If 
     
    '取得第一个要抓的通道 
    For i = 0 To 4 
        If g_bCircularSource(i) Then 
            g_nCapSourceCount = g_nCapSourceCount + 1 
            g_nSource = i 
            Exit For 
        End If 
    Next i 
     
    '所有通道都不抓,直接返回 
    If g_nCapSourceCount = 0 Then 
        Exit Sub 
    End If 
     
    '更新全局变量 
    g_nCycNum = CLng(editInterval.Text) 
    g_bCircularSnapBmp = radioBmp.Value 
    g_strCircularSnapDir = editPath.Text 
    g_nPersist = CLng(editTime.Text) 
     
    g_nCircularPicCount = 1 
     
    '记录当前通道 
    m_nCurVideo = formMain.SDK30001.VideoSource 
    formMain.SDK30001.VideoSource = g_nSource 
     
    '开始抓图 
    Call SetTimer(Me.hwnd, 1, g_nPersist * 1000, AddressOf formCapPic_OnTimer) 
    Call formMain.SDK30001.EnableCapSourceStream(3, AddressOf MyPrcPic) 
     
End Sub 
 
Private Sub Form_Load() 
    '为各路是否抓拍赋值 
    Dim i As Long 
    If g_bCircularSource(0) Then 
        checkVideo1.Value = Checked 
    End If 
     
    If g_bCircularSource(1) Then 
        checkVideo2.Value = Checked 
    End If 
     
    If g_bCircularSource(2) Then 
        checkVideo3.Value = Checked 
    End If 
     
    If g_bCircularSource(3) Then 
        checkVideo4.Value = Checked 
    End If 
     
    If g_bCircularSource(4) Then 
        checkSVideo.Value = Checked 
    End If 
     
    editInterval.Text = CStr(g_nCycNum) 
    editPath.Text = g_strCircularSnapDir 
    radioBmp.Value = g_bCircularSnapBmp 
    editTime.Text = CStr(g_nPersist) 
     
    g_bContinuous = False 
    g_nCapSourceCount = 0 
     
End Sub