导航:  Windows Procedures >

AfxFolderExists

上一页返回章节概述下一页

描述

 

搜索一个文件或子目录名匹配一个特定名称的目录(或部分名称,如果使用通配符).

 

FreeBASIC 语法

 

FUNCTION AfxFolderExists (BYVAL pwszFileSpec AS WSTRING PTR) AS BOOLEAN

 

参数

 

pwszFileSpec

[in]目录或路径和文件名,可以包含通配符,例如,(*)星号或问号(?).

This parameter should not be NULL, an invalid string (for example, an empty string or a string that is missing the terminating null character), or end in a trailing backslash (\).

If the string ends with a wildcard, period (.), or directory name, the user must have access permissions to the root and all subdirectories on the path.

To extend the limit of MAX_PATH wide characters to 32,767 wide characters, prepend "\\?\" to the path.

 

返回值

 

Boolean.TRUE如果指定的文件存在或FALSE否则.

 

备注

 

把绳子"\\?\"不允许访问根目录.

在网络股,你可以在下面的表格使用pwszFileSpec:'\\服务器\服务\'.然而,你不可能用一个pwszFileSpec指股票本身;例如,'\\服务器\服务'是无效的.

检查目录不是根目录的路径,使用的目录,没有一个反斜线.例如,'C + \'窗口的参数返回有关目录'C + \'窗口的信息,而不是关于'Windows'中的目录或文件.检查'C文件和目录:\ Windows',使用'C pwszFileSpec:\ Windows \'.

请注意,其他一些线程或进程可以在查询结果的时间和在信息上作用的时间之间创建或删除具有此名称的文件.如果这是您的应用程序的一个潜在的问题,一个可能的解决方案是与CREATE_NEW使用CreateFile功能(失败如果文件存在)或OPEN_EXISTING(失败,如果文件不存在).

 

引用文件

 

AfxWin.inc