Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

AVIFileOpen (avifil32)
 
.
Summary
TODO - a short description

C# Signature:

[DllImport("avifil32.dll")]
static extern int AVIFileOpen(out IntPtr ppfile, string szFile, uint mode, int pclsidHandler);

VB Signature:

Private Declare Function AVIFileOpen Lib "avifil32" Alias "AVIFileOpenA" (ByRef ppfile As Integer, ByVal szFile As String, ByVal mode As Integer, ByVal pclsidHandler As Integer) As Integer

User-Defined Types:

Structure AVIInfo

   Dim dwMaxBytesPerSec As Long
   Dim dwFlags As Long
   Dim dwCaps As Long
   Dim dwStreams As Long
   Dim dwSuggestedBufferSize As Long
   Dim dwWidth As Long
   Dim dwHeight As Long
   Dim dwScale As Long
   Dim dwRate As Long
   Dim dwLength As Long
   Dim dwEditCount As Long
   <VBFixedString(64), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=64)> Public szFileType As String

End Structure

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Structure AVIInfo

   Dim dwMaxBytesPerSec As Long
   Dim dwFlags As Long
   Dim dwCaps As Long
   Dim dwStreams As Long
   Dim dwSuggestedBufferSize As Long
   Dim dwWidth As Long
   Dim dwHeight As Long
   Dim dwScale As Long
   Dim dwRate As Long
   Dim dwLength As Long
   Dim dwEditCount As Long
   <VBFixedString(64), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=64)> Public szFileType As String

End Structure

'if a valid file, return the AVIFILEINFO structure

public Function Avi_Lenght(ByVal sAVIFile as String) as int32

Dim hFile As Long

Dim AFI As AVIFILEINFO

'initialize the AVIFile library

AVIFileInit()

If AVIFileOpen(hFile, sAVIFile, OF_SHARE_DENY_WRITE, 0&) = 0 Then

        Dim aviFileInfo_lsize = Marshal.SizeOf(GetType(AVIFILEINFO))

        AVIFileInfo(Instance, AFI , aviFileInfo_lsize)

Else

'Your Error handling Here

end If

AVIFileExit()

Return System.Math.Round(AFI .dwLength / ((AFI .dwRate / AFI .dwScale)), 3)

End Function

A full working version is located here http://ess-image.com/Graphic/Video/AviInfo.aspx Reading AVI information In VB .net

This sample as well as other image procssing source code provided by http://Ess-image.com">Ess-image.com

microsoft.public.dotnet.framework.interop has a working example code to call AVIInit, AVIExit, and AVIFileInfo.

http://groups.google.com/group/microsoft.public.dotnet.framework.interop/browse_thread/thread/9c06b6ed292a8ea8/012f9e44dad14284?lnk=gst&q=avifileinfo&rnum=1#012f9e44dad14284

Documentation
AVIFileOpen on MSDN

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions