Compartir a través de


Función PathMakePrettyW (shlwapi.h)

Convierte una ruta de acceso en mayúsculas en todos los caracteres en minúsculas para proporcionar a la ruta de acceso una apariencia coherente.

Sintaxis

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

Parámetros

[in, out] pszPath

Tipo: LPTSTR

Puntero a una cadena terminada en null de longitud MAX_PATH que contiene la ruta de acceso que se va a convertir.

Valor devuelto

Tipo: BOOL

Devuelve TRUE si la ruta de acceso se ha convertido o FALSE en caso contrario.

Comentarios

Esta función solo funciona en rutas de acceso que están completamente en mayúsculas. Por ejemplo: C:\WINDOWS se convertirá en c:\windows, pero c:\Windows no se cambiará.

Ejemplos

#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

Nota:

El encabezado shlwapi.h define PathMakePretty como alias que selecciona automáticamente la versión ANSI o Unicode de esta función en función de la definición de la constante de preprocesador UNICODE. La combinación del uso del alias neutro de codificación con código que no es neutral de codificación puede provocar discrepancias que dan lugar a errores de compilación o en tiempo de ejecución. Para obtener más información, vea Convenciones para prototipos de función.

Requisitos

Requisito Value
Cliente mínimo compatible Windows 2000 Professional, Windows XP [solo aplicaciones de escritorio]
Servidor mínimo compatible Windows 2000 Server [solo aplicaciones de escritorio]
Plataforma de destino Windows
Encabezado shlwapi.h
Library Shlwapi.lib
Archivo DLL Shlwapi.dll (versión 4.71 o posterior)