如何在VB 6中使用VLC Activex插件拍摄快照

时间:2015-07-14 10:20:21

标签: vb6 vlc

我正在使用VLC Activex插件从视频流中获取快照
但是当我调用函数vlc.video.takeSnapshot时,它返回 Nothing
这是代码:

Dim pic As IPictureDisp
vlc.playlist.pause                  '--Video is paused
Set pic = vlc.video.takeSnapshot    '--Take snapshot and set it into pic
vlc.playlist.play                   '--Video play again
If pic Is Nothing Then
   Debug.Print "Nothing in pic"
End If

中间窗口显示:'图片中没有任何内容'

takeSnapshot函数定义:

Function takeSnapshot() As IPictureDisp
Member of AXVLC.IVLCVideo
take video snapshot and save it into picture object.

任何人都有帮助,这个功能不再适用了,对吧?

1 个答案:

答案 0 :(得分:0)

Dim resp As Variant
Dim ls_prev_path As String
Dim ls_temp_path As String
Dim pic As IPictureDisp

ls_prev_path = CurDir
ls_temp_path = App.Path + IIf(Right(App.Path, 1) = "\", "", "\")
ls_temp_path = ls_temp_path + "tmp_snapshot\"

If Dir(ls_temp_path, vbDirectory) <> "" Then
    If Dir(ls_temp_path + "*.bmp") <> "" Then Kill ls_temp_path + "*.bmp"
Else
    MkDir ls_temp_path
End If

ChDir ls_temp_path

vlc1.playlist.pause
Set resp = vlc1.video.takeSnapshot()
vlc1.playlist.play

DoEvents

If Dir(ls_temp_path + "*.*") <> "" Then
    ls_pic_file = ls_temp_path + Dir(ls_temp_path + "*.*")
    Set pic = LoadPicture(ls_pic_file)
End If

ChDir ls_prev_path