Função PathMakePrettyW (shlwapi.h)

Converte um caminho em letras maiúsculas em todos os caracteres minúsculos para dar ao caminho uma aparência consistente.

Sintaxe

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

Parâmetros

[in, out] pszPath

Tipo: LPTSTR

Um ponteiro para uma cadeia de caracteres de comprimento terminada em nulo MAX_PATH que contém o caminho a ser convertido.

Retornar valor

Tipo: BOOL

Retornará TRUE se o caminho tiver sido convertido ou FALSE caso contrário.

Comentários

Essa função opera apenas em caminhos totalmente maiúsculos. Por exemplo: C:\WINDOWS será convertido em c:\windows, mas c:\Windows não será alterado.

Exemplos

#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

Observação

O cabeçalho shlwapi.h define PathMakePretty como um alias que seleciona automaticamente a versão ANSI ou Unicode dessa função com base na definição da constante de pré-processador UNICODE. Misturar o uso do alias neutro de codificação com código que não seja neutro em codificação pode levar a incompatibilidades que resultam em erros de compilação ou de runtime. Para obter mais informações, consulte Convenções para protótipos de função.

Requisitos

Requisito Valor
Cliente mínimo com suporte Windows 2000 Professional, Windows XP [somente aplicativos da área de trabalho]
Servidor mínimo com suporte Windows 2000 Server [somente aplicativos da área de trabalho]
Plataforma de Destino Windows
Cabeçalho shlwapi.h
Biblioteca Shlwapi.lib
DLL Shlwapi.dll (versão 4.71 ou posterior)