欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Win32 API File Manage

程序员文章站 2022-07-05 12:54:22
...

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.


转载于:https://www.cnblogs.com/yefengmeander/archive/2012/11/25/2887562.html