Freigeben über


PathMakePrettyW-Funktion (shlwapi.h)

Konvertiert einen vollständigen Pfad in Großbuchstaben in alle Kleinbuchstaben, um dem Pfad ein einheitliches Erscheinungsbild zu verleihen.

Syntax

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

Parameter

[in, out] pszPath

Typ: LPTSTR-

Ein Zeiger auf eine mit Null beendete Zeichenfolge MAX_PATH, die den zu konvertierenden Pfad enthält.

Rückgabewert

Typ: BOOL-

Gibt TRUE zurück, wenn der Pfad konvertiert wurde, oder FALSE- andernfalls.

Bemerkungen

Diese Funktion wird nur auf Pfaden ausgeführt, die vollständig groß geschrieben sind. Beispiel: C:\WINDOWS wird in c:\windows konvertiert, aber c:\Windows wird nicht geändert.

Beispiele

#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

Anmerkung

Der Header "shlwapi.h" definiert PathMakePretty als Alias, der die ANSI- oder Unicode-Version dieser Funktion basierend auf der Definition der UNICODE-Präprozessorkonstante automatisch auswählt. Das Mischen der Verwendung des codierungsneutralen Alias mit Code, der nicht codierungsneutral ist, kann zu Nichtübereinstimmungen führen, die zu Kompilierungs- oder Laufzeitfehlern führen. Weitere Informationen finden Sie unter Konventionen für Funktionsprototypen.

Anforderungen

Anforderung Wert
mindestens unterstützte Client- Windows 2000 Professional, Windows XP [nur Desktop-Apps]
mindestens unterstützte Server- Windows 2000 Server [nur Desktop-Apps]
Zielplattform- Fenster
Header- shlwapi.h
Library Shlwapi.lib
DLL- Shlwapi.dll (Version 4.71 oder höher)