PathMakePrettyA-Funktion (shlwapi.h)

Konvertiert einen ganz groß geschriebenen Pfad in alle Kleinbuchstaben, um dem Pfad ein konsistentes Erscheinungsbild zu verleihen.

Syntax

BOOL PathMakePrettyA(
  [in, out] LPSTR pszPath
);

Parameter

[in, out] pszPath

Typ: LPTSTR

Ein Zeiger auf eine mit NULL endende Zeichenfolge der Länge MAX_PATH, die den zu konvertierenden Pfad enthält.

Rückgabewert

Typ: BOOL

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

Hinweise

Diese Funktion funktioniert nur für Pfade, 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

Hinweis

Der shlwapi.h-Header 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
Unterstützte Mindestversion (Client) Windows 2000 Professional, Windows XP [nur Desktop-Apps]
Unterstützte Mindestversion (Server) Windows 2000 Server [nur Desktop-Apps]
Zielplattform Windows
Kopfzeile shlwapi.h
Bibliothek Shlwapi.lib
DLL Shlwapi.dll (Version 4.71 oder höher)