ファイルの表示名の取得

(2003.09.18)
    static CString GetDisplayName(LPCTSTR szFileName)
    {
        CSHFileInfo info;
        UINT uFlags = SHGFI_DISPLAYNAME;
        DWORD_PTR dwResult = ::SHGetFileInfo(szFileName, 0, &info, sizeof(info), uFlags);
        if (dwResult == 0)
        {
            return CString();
        }
 
        return info.szDisplayName;
    }
    static CString GetDisplayName(LPCITEMIDLIST pidl)
    {
        CSHFileInfo info;
        UINT uFlags = SHGFI_DISPLAYNAME | SHGFI_PIDL;
        DWORD_PTR dwResult = ::SHGetFileInfo((LPCTSTR)pidl, 0, &info, sizeof(info), uFlags);
        if (dwResult == 0)
        {
            return CString();
        }
 
        return info.szDisplayName;
    }
一覧に戻る
© 2003 WAC.com All Right Reserved.