[VB.NET 2005] Utilisation Api Avifil32
Bonjours tout le monde, voila j'ai un probleme avec l'api "avifil32" pour obtenir des infos sur les fichiers avi.J'arrive a ouvrir le fichier avec la fonction "AVIFileOpen" mais aucun moyen de faire fonctionner la fonction pour obtenir les infos "AVIFileInfo".
Les fonctions doivent retourné 0 si sa marche.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| Imports System.Runtime.InteropServices
Public Class TEST
#Region "Structure"
<StructLayout(LayoutKind.Sequential, Pack:=1)> Private Structure AVIFILEINFO
Public dwMaxBytesPerSecond As Int32
Public dwFlags As Int32
Public dwCaps As Int32
Public dwStreams As Int32
Public dwSuggestedBufferSize As Int32
Public dwWidth As Int32
Public dwHeight As Int32
Public dwScale As Int32
Public dwRate As Int32
Public dwLength As Int32
Public dwEditCount As Int32
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=64)> Public szFileType As Char()
End Structure
#End Region
#Region "Declarations"
'Fonction D'ouverture du fichier avi
Private Declare Auto Function AVIFileOpen Lib "avifil32" (ByRef ppfile As IntPtr, ByVal szFile As String, ByVal mode As Integer, ByVal pclsidHandler As Integer) As Integer
'Fonction pour relacher le fichier
Private Declare Auto Function AVIFileRelease Lib "avifil32" (ByVal pfile As IntPtr) As Integer
'Fonction pour recupurer les informations du fichier ouvert
Private Declare Auto Function AVIFi Lib "avifil32" Alias "AVIFileInfo" (ByVal pfile As IntPtr, ByRef pfi As AVIFILEINFO, ByVal lSize As Integer) As Integer
'Fonction pour initialiser l'api
Private Declare Auto Sub AVIFileInit Lib "avifil32" ()
'Fonction pour fermer l'api
Private Declare Auto Sub AVIFileExit Lib "avifil32" ()
#End Region
#Region "Constantes"
Private Const OF_SHARE_DENY_WRITE As Integer = 32
Private Const OF_READWRITE As Integer = 2
#End Region
#Region "Functions"
Function GetAviInformations() As String
Dim H_File As New IntPtr
Dim pfi As New AVIFILEINFO
AVIFileInit()
AVIFileOpen(H_File, "c:/test.avi", OF_READWRITE, 0)
'Devrait retourné 0
Debug.WriteLine(AVIFi(H_File, pfi, Marshal.SizeOf(pfi)))
AVIFileRelease(H_File)
AVIFileExit()
Return "Test"
End Function
#End Region
End Class |
AVIFileInfo
AVIFILEINFO
Merci beaucoup :)