您的位置:首页 > 其它

windows中目录字符串处理函数, MSDN里有使用的例子

2012-01-01 15:30 771 查看

PathSearchAndQualify Function

Determines if a given path is correctly formatted and fully qualified.

Syntax

BOOL PathSearchAndQualify(      
    LPCTSTR pcszPath,
    LPTSTR pszFullyQualifiedPath,
    UINT cchFullyQualifiedPath
);


Parameters

pcszPath[in] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path to search.pszFullyQualifiedPath[out] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path to be referenced.cchFullyQualifiedPath[in] Width of the path pointed to by pszFullyQualifiedPath, in characters.
Return Value
Returns TRUE if the path is qualified, or FALSE otherwise.

PathSetDlgItemPath Function

Sets the text of a child control in a window or dialog box, using PathCompactPath to make sure the path fits in the control.

Syntax

void PathSetDlgItemPath(      
    HWND hDlg,
    int id,
    LPCSTR pszPath
);


Parameters

hDlg[in] Handle to the dialog box or window. id[in] Identifier of the control. pszPath[in] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path to set in the control.

Return Value
No return value.

PathSkipRoot Function

Parses a path, ignoring the drive letter or Universal Naming Convention (UNC) server/share path parts.

Syntax

LPTSTR PathSkipRoot(      
    LPCTSTR pszPath
);


Parameters

pszPath[in, out] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path to parse.
Return Value
Returns the address of the beginning of the subpath that follows the root (drive letter or UNC server/share).

PathUndecorate Function

Removes the decoration from a path string.

Syntax

void PathUndecorate(      
    LPTSTR pszPath
);


Parameters

pszPath[in] Null-terminated string that contains the path. When the function returns,
pszPath points to the undecorated string.
Return Value
No return value.
Remarks

A decoration consists of a pair of square brackets with one or more digits in between, inserted immediately after the base name and before the file name extension.

Example

The following table illustrates how strings are modified by PathUndecorate.

Initial StringUndecorated String
C:\Path\File[5].txtC:\Path\File.txt
C:\Path\File[12]C:\Path\File
C:\Path\File.txtC:\Path\File.txt
C:\Path\[3].txtC:\Path\[3].txt

PathStripPath Function

Removes the path portion of a fully qualified path and file.

Syntax

void PathStripPath(      
    LPTSTR pszPath
);


Parameters

pszPath[in, out] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path and file name that will have the path portion removed.
Return Value
No return value.

PathStripToRoot Function

Removes all parts of the path except for the root information.

Syntax

BOOL PathStripToRoot(      
    LPTSTR szRoot
);


Parameters

szRoot[in, out] Pointer to a null-terminated string of maximum length MAX_PATH that contains the path to be converted.
Return Value
Returns TRUE if a valid drive letter was found in the path, or FALSE otherwise.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息