ファイルの種類の取得

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