PathMakePrettyW 関数 (shlwapi.h)

パスを一貫した外観にするために、すべて大文字のパスをすべての小文字に変換します。

構文

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

パラメーター

[in, out] pszPath

種類: LPTSTR

変換するパスを含む長さMAX_PATHの null で終わる文字列へのポインター。

戻り値

種類: BOOL

パスが変換されている場合は TRUE 、それ以外の場合は FALSE を 返します。

注釈

この関数は、完全に大文字のパスでのみ動作します。 たとえば、C:\WINDOWS は c:\windows に変換されますが、c:\Windows は変更されません。

#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

Note

shlwapi.h ヘッダーは PathMakePretty をエイリアスとして定義します。このエイリアスは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI または Unicode バージョンを自動的に選択します。 encoding-neutral エイリアスの使用を encoding-neutral ではないコードと混在すると、コンパイル エラーまたはランタイム エラーが発生する不一致が発生する可能性があります。 詳細については、「 関数プロトタイプの規則」を参照してください。

要件

要件
サポートされている最小のクライアント Windows 2000 Professional、Windows XP [デスクトップ アプリのみ]
サポートされている最小のサーバー Windows 2000 Server [デスクトップ アプリのみ]
対象プラットフォーム Windows
ヘッダー shlwapi.h
Library Shlwapi.lib
[DLL] Shlwapi.dll (バージョン 4.71 以降)