win2000下有没有人用过这个api函数?(200分)

  • 主题发起人 windflow
  • 开始时间
W

windflow

Unregistered / Unconfirmed
GUEST, unregistred user!
function &nbsp;AVIFileOpen(avifile : pointer; filename : pchar; mode : integer;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CLSID : pointer) : integer; stdcall; external 'avifil32.dll' index 16;<br>.....<br>var favifile:pointer;<br>if AVIFileOpen(favifile, pchar(AviFileName), 0 ,nil)&lt;&gt;0 then exit;<br>函数返回0才是执行成功,这个函数我在98,2000里试了一下,98正常,但2000总是不成功,<br>不知哪位高人指点一下?
 
请看:<br>AVIFileOpen<br>The AVIFileOpen function opens an AVI file and returns the address of a file interface used to access it. The AVIFile library maintains a count of the number of times a file is opened, but not the number of times it was released. Use the AVIFileRelease function to release the file and decrement the count. <br><br>STDAPI AVIFileOpen(<br>&nbsp; PAVIFILE * ppfile, &nbsp; &nbsp; <br>&nbsp; LPCTSTR szFile, &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; UINT mode, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br>&nbsp; CLSID * pclsidHandler &nbsp;<br>);<br>&nbsp;<br>Parameters<br>ppfile <br>Address to contain the new file interface pointer. <br>szFile <br>Null-terminated string containing the name of the file to open. <br>mode <br>Access mode to use when opening the file. The default access mode is OF_READ. The following access modes can be specified with AVIFileOpen: <br>OF_CREATE <br>Creates a new file. If the file already exists, it is truncated to zero length. <br>OF_SHARE_DENY_NONE <br>Opens the file nonexclusively. Other processes can open the file with read or write access. AVIFileOpen fails if another process has opened the file in compatibility mode. <br>OF_SHARE_DENY_READ <br>Opens the file nonexclusively. Other processes can open the file with write access. AVIFileOpen fails if another process has opened the file in compatibility mode or has read access to it. <br>OF_SHARE_DENY_WRITE <br>Opens the file nonexclusively. Other processes can open the file with read access. AVIFileOpen fails if another process has opened the file in compatibility mode or has write access to it. <br>OF_SHARE_EXCLUSIVE <br>Opens the file and denies other processes any access to it. AVIFileOpen fails if any other process has opened the file. <br>OF_READ <br>Opens the file for reading. <br>OF_READWRITE <br>Opens the file for reading and writing. <br>OF_WRITE <br>Opens the file for writing. <br>pclsidHandler <br>Address of a class identifier of the standard or custom handler you want to use. If the value is NULL, the system chooses a handler from the registry based on the file extension or the RIFF type specified in the file. <br>Return Values<br>Returns zero if successful or an error otherwise. Possible error values include the following:<br><br>Value Description <br>AVIERR_BADFORMAT The file couldn't be read, indicating a corrupt file or an unrecognized format. <br>AVIERR_MEMORY The file could not be opened because of insufficient memory. <br>AVIERR_FILEREAD A disk error occurred while reading the file. <br>AVIERR_FILEOPEN A disk error occurred while opening the file. <br>REGDB_E_CLASSNOTREG According to the registry, the type of file specified in AVIFileOpen does not have a handler to process it. &nbsp;<br><br><br>QuickInfo<br>&nbsp; Windows NT: Requires version 3.1 or later.<br>&nbsp; Windows: Requires Windows 95 or later.<br>&nbsp; Windows CE: Unsupported.<br>&nbsp; Header: Declared in vfw.h.<br>&nbsp; Import Library: Use vfw32.lib.<br>&nbsp; Unicode: Implemented as Unicode and ANSI versions on Windows NT.<br><br>See Also<br>AVIFile Functions and Macros Overview, AVIFile Functions, AVIFileRelease<br>这就是msdn的解释。<br>&nbsp;<br>
 
&gt;var favifile:pointer;<br>改为:var favifile:^pointer;才能编译啊:)<br><br>返回值是-2147221008,但用GetLastError()看却返回0,晕。。。
 
to chenxz:你也是在用这个函数吗?请问你现在有什么办法吗?
 
看一下2000下是不是没有装媒体的解码器,<br>比如Divx之类的,你要打开的AVI文件应该不是标准的AVI吧?
 
为了证明是不是解压的驱动问题,我特意安装了divx4,但问题依旧,<br>我用vc调用这个 api成功了,但我发现vc的vfw.h里的定义与vfw.pas里的有点不同。<br>我在delphi里安vc的定义重新写过,也不行。
 
在AVIFileOpen之前首先执行AVIFileInit就可以了。大概是这样的:<br>&nbsp; AVIFileInit;<br>&nbsp; AVIFileName:='C:/MyCap.AVI';<br>&nbsp; AVIFileOpen(FAVIFile,PChar(AVIFileName),OF_READ,nil);<br>
 
顶部