Win32 API File Manage

来源:互联网 发布:js new date 北京时间 编辑:程序博客网 时间:2024/04/29 14:45

http://msdn.microsoft.com/en-us/library/aa365430(v=vs.85).aspx

OpenFile function

HFILE WINAPI OpenFile(  _In_   LPCSTR lpFileName,  _Out_  LPOFSTRUCT lpReOpenBuff,  _In_   UINT uStyle);

Return value

If the function succeeds, the return value specifies a file handle to use when performing file I/O. To close the file, call the CloseHandle function using this handle.

If the function fails, the return value is HFILE_ERROR. To get extended error information, call GetLastError.

Remarks

If the lpFileName parameter specifies a file name and extension only, this function searches for a matching file in the following directories and the order shown:

  1. The directory where an application is loaded.

  2. The current directory.

  3. The Windows system directory.

    Use the GetSystemDirectory function to get the path of this directory.

  4. The 16-bit Windows system directory.

    There is not a function that retrieves the path of this directory, but it is searched.

  5. The Windows directory.

    Use the GetWindowsDirectory function to get the path of this directory.

  6. The directories that are listed in the PATH environment variable.

The lpFileName parameter cannot contain wildcard characters.