PathParseIconLocationW 函数 (shlwapi.h)

分析包含文件位置和图标索引的文件位置字符串,并返回单独的值。

语法

int PathParseIconLocationW(
  [in, out] LPWSTR pszIconFile
);

参数

[in, out] pszIconFile

类型: LPTSTR

指向长度为 null 的字符串MAX_PATH的指针,该字符串包含文件位置字符串。 它应采用“path,iconindex”格式。 函数返回时, pszIconFile 将指向文件的路径。

返回值

类型: int

返回有效的图标索引值。

注解

此函数可用于获取 SHGetValue 从注册表检索到的 DefaultIcon 值,并将图标索引与路径分隔开来。

示例

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

void main(void)
{
// Path to parse for file and icon index.
char buffer_1[ ] = "C:\\TEST\\sample.txt,3"; 
char *lpStr1;
lpStr1 = buffer_1;

// Return value from "PathParseIconLocation".
int retval;

// Search a path to parse for file and icon index.
retval = PathParseIconLocation(lpStr1);
cout << "The path to parse for file and icon index is   : " << lpStr1 << endl;
cout << "PathParseIconLocation returns the icon index of: " << retval << endl;
}

OUTPUT:
==========
The path to parse for file and icon index is   : C:\TEST\sample.txt
PathParseIconLocation returns the icon index of: 3

注意

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

要求

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