注册名:

密码:

个人注册

企业注册

商务申请

商务管理平台

企业管理平台

个人管理平台

我的工控博客

中国工控网www.chinakong.com

首页 | 新闻中心 | 工控论坛 | 经验视点 | 工控商务 | 电气手册 | 工控博客 | 招聘求职 | 网上调查 | 企业中心 | 供求信息 | 资料中心 | 工控书店

所在位置:工控博客苑 -- 大道繁简 -- 在ifix上实现视频监控录制

中国工控网搜索:

何先生

     学历:大学本科
     职称:在校大学生
     年龄:34岁
       新闻信息(0/0)
       工作图片(0)
       技术论文(1/0)
       交流论坛(0/0)
       留言信箱(0)
       浏览人次:3541

在ifix上实现视频监控录制

   作者:何贤挺    发布时间:2011年8月17日  

    这其中用到了相关控件是从网上下载,附件里有。如有问题请联系qq:407622496
    相关的代码:
    Private Sub cmdCapture_Click()
   
    Call ezVidCap1.CaptureVideo
   
    End Sub
   
   
    Private Sub cmdSaveDIB_Click() '保存位图
    Dim filename As String
    hwnd = FindWindow(vbNullString, "")
    If VBGetSaveFileName(filename, filter:="Bitmap文件 (*.bmp)|*.bmp", InitDir:=Application.Path, DlgTitle:="保存为图片", DefaultExt:="bmp", Owner:=hwnd) Then
    On Error Resume Next
    Call ezVidCap1.SaveDIB(filename)
    If Err Then
    MsgBox Err.Description, vbInformation, Application.Title
    ' Err.Description为错误信息; vbInformation 显示“通知消息”图标;Application.Title为标题栏名字
    End If
    End If
    End Sub
   
    Private Sub Command2_Click() '保存视频
    Dim filename As String
    hwnd = FindWindow(vbNullString, "")
    If VBGetSaveFileNamePreview(filename, FileMustExist:=False, filter:="AVI文件 (*.avi)|*.avi", InitDir:=Application.Path, DlgTitle:="保存视频文件", DefaultExt:="avi", Owner:=hwnd) Then
    On Error Resume Next
    Call ezVidCap1.SaveAs(filename)
    If Err Then ' Err.Description为错误信息; vbInformation 显示“通知消息”图标;Application.Title为标题栏名字
    MsgBox Err.Description, vbInformation, Application.Title
    End If
    End If
   
    End Sub
   
   
    Private Function FilterLookup(ByVal sFilters As String) As String
    Dim iStart As Long, iEnd As Long, s As String
    iStart = 1
    If sFilters = vbNullChar Then Exit Function
   
   
    iEnd = InStr(iStart, sFilters, vbNullChar)
    If iEnd = 0 Then Exit Function
    iEnd = InStr(iEnd + 1, sFilters, vbNullChar)
    If iEnd Then
    s = Mid$(sFilters, iStart, iEnd - iStart)
   
    Else
    s = Mid$(sFilters, iStart)
    End If
   
    FilterLookup = s
   
   
    End Function
   
   
   
    Public Function VBGetSaveFileName(filename As String, Optional FileTitle As String, Optional OverWritePrompt As Boolean = True, Optional filter As String = "All (*.*)| *.*", Optional FilterIndex As Long = 1, Optional InitDir As String = "", Optional DlgTitle As String = "", Optional DefaultExt As String = "", Optional Owner As Long = -1, Optional Flags As Long) As Boolean
   
    Dim opfile As OPENFILENAME, s As String
    With opfile
    .lStructSize = Len(opfile)
   
    .Flags = (-OverWritePrompt * OFN_OVERWRITEPROMPT) Or OFN_HIDEREADONLY
   
   
    If Owner <> -1 Then
    .hwndOwner = Owner
    .lpstrInitialDir = InitDir
    .lpstrDefExt = DefaultExt
    .lpstrTitle = DlgTitle
    End If
   
   
    Dim ch As String, I As Integer
    For I = 1 To Len(filter)
    ch = Mid$(filter, I, 1)
    If ch = "|" Or ch = ":" Then
    s = s & vbNullChar
    Else
    s = s & ch
    End If
    Next
    s = s & vbNullChar & vbNullChar
    .lpstrFilter = s
   
    s = filename & String$(MAX_PATH - Len(filename), 0)
    .lpstrFile = s
    .nMaxFile = MAX_PATH
    s = FileTitle & String$(MAX_FILE - Len(FileTitle), 0)
    .lpstrFileTitle = s
    .nMaxFileTitle = MAX_FILE
   
   
    If GetSaveFileName(opfile) Then
    VBGetSaveFileName = True
    filename = Left$(.lpstrFile, InStr(.lpstrFile, vbNullChar) - 1)
    FileTitle = Left$(.lpstrFileTitle, InStr(.lpstrFileTitle, vbNullChar) - 1)
    Flags = .Flags
    filter = FilterLookup(.lpstrFilter)
   
    Else
    VBGetSaveFileName = False
    filename = vbNullChar
    FileTitle = vbNullChar
    Flags = 0
    FilterIndex = 0
    filter = vbNullChar
    End If
    End With
    End Function
   
   
    Public Function VBGetSaveFileNamePreview(filename As String, Optional FileTitle As String = "", Optional FileMustExist As Boolean = True, Optional MultiSelect As Boolean = False, Optional ReadOnly As Boolean = False, Optional HideReadOnly As Boolean = False, Optional filter As String = "All (*.*)| *.*", Optional FilterIndex As Long = 1, Optional InitDir As String = "", Optional DlgTitle As String = "", Optional DefaultExt As String = "", Optional Owner As Long = -1, Optional Flags As Long = 0) As Boolean
   
    Dim opfile As OPENFILENAME, s As String, afFlags As Long
    With opfile
    .lStructSize = Len(opfile) '获取结构长度
   
    .Flags = (-FileMustExist * OFN_FILEMUSTEXIST) Or (-MultiSelect * OFN_ALLOWMULTISELECT) Or (-ReadOnly * OFN_READONLY) Or (-HideReadOnly * OFN_HIDEREADONLY)
    '文件夹必须存在 允许多选 只读 隐藏只读复选框
    If Owner <> -1 Then
    .hwndOwner = Owner
    .lpstrInitialDir = InitDir
    .lpstrDefExt = DefaultExt
    .lpstrTitle = DlgTitle
    End If
   
    Dim ch As String, I As Integer
    For I = 1 To Len(filter)
    ch = Mid$(filter, I, 1)
    If ch = "|" Or ch = ":" Then
    s = s & vbNullChar
    Else
    s = s & ch
    End If
    Next
    s = s & vbNullChar & vbNullChar
    .lpstrFilter = s
   
    s = filename & String$(MAX_PATH - Len(filename), 0)
    .lpstrFile = s
    .nMaxFile = MAX_PATH
    s = FileTitle & String$(MAX_FILE - Len(FileTitle), 0)
    .lpstrFileTitle = s
    .nMaxFileTitle = MAX_FILE
   
   
    If GetSaveFileNamePreview(opfile) Then
    VBGetSaveFileNamePreview = True
    filename = Left$(.lpstrFile, InStr(.lpstrFile, vbNullChar) - 1)
    FileTitle = Left$(.lpstrFileTitle, InStr(.lpstrFileTitle, vbNullChar) - 1)
    Flags = .Flags
    filter = FilterLookup(.lpstrFilter)
    If (.Flags And OFN_READONLY) Then ReadOnly = True
    Else
    VBGetSaveFileNamePreview = False
    filename = vbNullChar
    FileTitle = vbNullChar
    Flags = 0
    FilterIndex = -1
    filter = vbNullChar
    End If
    End With
    End Function
 
     相关技术论文:

关于我们     免责声明     服务项目     广告联系     友情链接     联系方式     意见反馈     设为首页     加入收藏

 ©2023-2025 中国工控网(www.chinakong.com) 版权所有 豫ICP备17046657号

管理员信箱:chinakong98@163.com  服务热线:13525974529

洛阳博德工控自动化技术有限公司

中国    洛阳