PathParseIconLocationA 函式 (shlwapi.h)

剖析包含檔案位置和圖示索引的檔案位置字串,並傳回個別的值。

語法

int PathParseIconLocationA(
  [in, out] LPSTR 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 標頭會根據 UNICODE 預處理器常數的定義,將 PathParseIconLocation 定義為別名,自動選取此函式的 ANSI 或 Unicode 版本。 混合使用編碼中性別名與非編碼中性的程序代碼,可能會導致編譯或運行時間錯誤不符。 如需詳細資訊,請參閱 函式原型的慣例

規格需求

需求
最低支援的用戶端 Windows 2000 專業版、Windows XP [僅限傳統型應用程式]
最低支援的伺服器 Windows 2000 Server [僅限傳統型應用程式]
目標平台 Windows
標頭 shlwapi.h
程式庫 Shlwapi.lib
Dll Shlwapi.dll (4.71 版或更新版本)