Bagikan melalui


Fungsi PathParseIconLocationA (shlwapi.h)

Mengurai string lokasi file yang berisi lokasi file dan indeks ikon, dan mengembalikan nilai terpisah.

Sintaks

int PathParseIconLocationA(
  [in, out] LPSTR pszIconFile
);

Parameter

[in, out] pszIconFile

Jenis: LPTSTR

Penunjuk ke string panjang yang dihentikan null MAX_PATH yang berisi string lokasi file. Ini harus dalam bentuk "path,iconindex". Ketika fungsi kembali, pszIconFile akan menunjuk ke jalur file.

Nilai kembali

Jenis: int

Mengembalikan nilai indeks ikon yang valid.

Keterangan

Fungsi ini berguna untuk mengambil nilai DefaultIcon yang diambil dari registri oleh SHGetValue dan memisahkan indeks ikon dari jalur.

Contoh

#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

Catatan

Header shlwapi.h mendefinisikan PathParseIconLocation sebagai alias yang secara otomatis memilih versi ANSI atau Unicode dari fungsi ini berdasarkan definisi konstanta pra-prosesor UNICODE. Mencampur penggunaan alias encoding-netral dengan kode yang tidak mengodekan-netral dapat menyebabkan ketidakcocokan yang mengakibatkan kesalahan kompilasi atau runtime. Untuk informasi selengkapnya, lihat Konvensi untuk Prototipe Fungsi.

Persyaratan

Persyaratan Nilai
Klien minimum yang didukung Windows 2000 Professional, Windows XP [hanya aplikasi desktop]
Server minimum yang didukung Windows 2000 Server [hanya aplikasi desktop]
Target Platform Windows
Header shlwapi.h
Pustaka Shlwapi.lib
DLL Shlwapi.dll (versi 4.71 atau yang lebih baru)