PathRemoveArgsW 函数 (shlwapi.h)

从给定路径中删除任何参数。

语法

void PathRemoveArgsW(
  [in, out] LPWSTR pszPath
);

参数

[in, out] pszPath

类型: LPTSTR

指向长度为 null 的字符串的指针MAX_PATH,该字符串包含要从中删除参数的路径。

返回值

备注

不应在用户或注册表) (的泛型命令路径模板上使用此函数,而应仅在应用程序知道格式良好的模板上使用。

示例

#include <windows.h>
#include <iostream.h>
#include "Shlwapi.h"

void main( void )
{
    // Path with arguments.
    char buffer_1[ ] = "c:\\a\\b\\FileA Arg1 Arg2"; 
    char *lpStr1;
    lpStr1 = buffer_1;
    
    // Path before "PathRemoveArgs".
    cout << "Path before calling \"PathRemoveArgs\": " << lpStr1 << endl;
    
    // Call function "PathRemoveArgs".
    PathRemoveArgs(lpStr1);
    
    // Path after "PathRemoveArgs".
    cout << "Path after calling \"PathRemoveArgs\": " << lpStr1 << endl;
}

OUTPUT:
==================
Path before calling "PathRemoveArgs": c:\a\b\FileA Arg1 Arg2
Path after calling "PathRemoveArgs": c:\a\b\FileA

注意

shlwapi.h 标头将 PathRemoveArgs 定义为别名,该别名根据 UNICODE 预处理器常量的定义自动选择此函数的 ANSI 或 Unicode 版本。 将非特定编码别名的使用与非非特定编码的代码混合使用可能会导致不匹配,从而导致编译或运行时错误。 有关详细信息,请参阅 函数原型的约定

要求

要求
最低受支持的客户端 Windows 2000 专业版、Windows XP [仅限桌面应用]
最低受支持的服务器 Windows 2000 Server [仅限桌面应用]
目标平台 Windows
标头 shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (版本 4.71 或更高版本)