Partager via


Fonction PathMakePrettyW (shlwapi.h)

Convertit un chemin d’accès en majuscules en caractères minuscules pour donner au chemin une apparence cohérente.

Syntaxe

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

Paramètres

[in, out] pszPath

Type : LPTSTR

Pointeur vers une chaîne de longueur terminée par null MAX_PATH qui contient le chemin à convertir.

Valeur retournée

Type : BOOL

Retourne TRUE si le chemin a été converti, ou FALSE dans le cas contraire.

Remarques

Cette fonction fonctionne uniquement sur des chemins entièrement en majuscules. Par exemple : C :\WINDOWS sera converti en c :\windows, mais c :\Windows ne sera pas modifié.

Exemples

#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

Notes

L’en-tête shlwapi.h définit PathMakePretty comme un alias qui sélectionne automatiquement la version ANSI ou Unicode de cette fonction en fonction de la définition de la constante de préprocesseur UNICODE. Le mélange de l’utilisation de l’alias neutre en encodage avec du code qui n’est pas neutre en encodage peut entraîner des incompatibilités qui entraînent des erreurs de compilation ou d’exécution. Pour plus d’informations, consultez Conventions pour les prototypes de fonction.

Configuration requise

Condition requise Valeur
Client minimal pris en charge Windows 2000 Professionnel, Windows XP [applications de bureau uniquement]
Serveur minimal pris en charge Windows 2000 Server [applications de bureau uniquement]
Plateforme cible Windows
En-tête shlwapi.h
Bibliothèque Shlwapi.lib
DLL Shlwapi.dll (version 4.71 ou ultérieure)