Bagikan melalui


Fungsi PathMakePrettyW (shlwapi.h)

Mengonversi jalur semua huruf besar ke semua karakter huruf kecil untuk memberikan jalur tampilan yang konsisten.

Sintaks

BOOL PathMakePrettyW(
  [in, out] LPWSTR pszPath
);

Parameter

[in, out] pszPath

Jenis: LPTSTR

Penunjuk ke string panjang yang dihentikan null MAX_PATH yang berisi jalur yang akan dikonversi.

Nilai kembali

Jenis: BOOL

Mengembalikan TRUE jika jalur telah dikonversi, atau FALSE sebaliknya.

Keterangan

Fungsi ini hanya beroperasi pada jalur yang sepenuhnya huruf besar. Misalnya: C:\WINDOWS akan dikonversi ke c:\windows, tetapi c:\Windows tidak akan diubah.

Contoh

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

void main( void )
{
// Path name 1.
char buffer_1[ ] = "C:\\TEST\\FILE";
char *lpStr1;
lpStr1 = buffer_1;

// Path name 2.
char buffer_2[ ] = "c:\\test\\file";
char *lpStr2;
lpStr2 = buffer_2;

// Test path name 1.
    cout << "The content of the unconverted path is : " << lpStr1 << endl;
    cout << "The \"PathMakePretty\" function returns the value " 
         << PathMakePretty(lpStr1) << "  = TRUE & converts"  << endl;
    cout << "The content of the converted path is   : " << lpStr1 << endl;

// Test path name 2.
    cout << "\nThe content of the unconverted path is : " << lpStr2 << endl;
    cout << "The \"PathMakePretty\" function returns the value " 
         << PathMakePretty(lpStr2) << "  = FALSE & no conversion"  << endl;
    cout << "The content of the converted path is   : " << lpStr2 << endl;
}

OUTPUT:
=============
The content of the unconverted path is : C:\TEST\FILE
The "PathMakePretty" function returns the value 1  = TRUE & converts
The content of the converted path is   : C:\test\file

The content of the unconverted path is : c:\test\file
The "PathMakePretty" function returns the value 0  = FALSE & no conversion
The content of the converted path is   : c:\test\file

Catatan

Header shlwapi.h mendefinisikan PathMakePretty sebagai alias yang secara otomatis memilih versi ANSI atau Unicode dari fungsi ini berdasarkan definisi konstanta praprosem 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)