获取特定的目录

 

 


 LPITEMIDLIST pidl;
    TCHAR szPath [MAX_PATH];
    if(SUCCEEDED( SHGetSpecialFolderLocation ( NULL, CSIDL_FAVORITES, &pidl )))
    {
        if ( SHGetPathFromIDList ( pidl, szPath ))
        {
            CString sDisplayName;
            SHFILEINFO    sfi;
            ZeroMemory(&sfi,sizeof(sfi));
            UINT uFlags = SHGFI_PIDL | SHGFI_DISPLAYNAME;
            SHGetFileInfo((LPCTSTR)pidl, 0, &sfi, sizeof(SHFILEINFO), uFlags);
            sDisplayName = sfi.szDisplayName;

            CString szDisplay;
            szDisplay.Format(_T(" %s  \n  \n %s"),szPath, sDisplayName);
            GetDlgItem(IDC_STATIC)->SetWindowText(szDisplay);
            CoTaskMemFree(pidl);          //free the resource
        }
    }  

 

CSIDL_ALTSTARTUP  File system directory that corresponds to the user's nonlocalized Startup program group.
CSIDL_APPDATA  File system directory that serves as a common repository for application-specific data.
CSIDL_BITBUCKET  File system directory containing file objects in the user's Recycle Bin. The location of this directory is not in the registry; it is marked with the hidden and system attributes to prevent the user from moving or deleting it.
CSIDL_COMMON_ALTSTARTUP  File system directory that corresponds to the nonlocalized Startup program group for all users.
CSIDL_COMMON_DESKTOPDIRECTORY  File system directory that contains files and folders that appear on the desktop for all users.
CSIDL_COMMON_FAVORITES  File system directory that serves as a common repository for all users' favorite items.
CSIDL_COMMON_PROGRAMS  File system directory that contains the directories for the common program groups that appear on the Start menu for all users.
CSIDL_COMMON_STARTMENU  File system directory that contains the programs and folders that appear on the Start menu for all users.
CSIDL_COMMON_STARTUP  File system directory that contains the programs that appear in the Startup folder for all users. 
CSIDL_CONTROLS  Virtual folder containing icons for the Control Panel applications.
CSIDL_COOKIES  File system directory that serves as a common repository for Internet cookies.
CSIDL_DESKTOP  Windows Desktop—virtual folder at the root of the namespace.
CSIDL_DESKTOPDIRECTORY  File system directory used to physically store file objects on the desktop (not to be confused with the desktop folder itself).
CSIDL_DRIVES  My Computer—virtual folder containing everything on the local computer: storage devices, printers, and Control Panel. The folder may also contain mapped network drives.
CSIDL_FAVORITES  File system directory that serves as a common repository for the user's favorite items.
CSIDL_FONTS  Virtual folder containing fonts.
CSIDL_HISTORY  File system directory that serves as a common repository for Internet history items.
CSIDL_INTERNET  Virtual folder representing the Internet.
CSIDL_INTERNET_CACHE  File system directory that serves as a common repository for temporary Internet files.
CSIDL_NETHOOD  File system directory containing objects that appear in the network neighborhood.
CSIDL_NETWORK  Network Neighborhood Folder—virtual folder representing the top level of the network hierarchy.
CSIDL_PERSONAL  File system directory that serves as a common repository for documents.
CSIDL_PRINTERS  Virtual folder containing installed printers.
CSIDL_PRINTHOOD  File system directory that serves as a common repository for printer links.
CSIDL_PROGRAMS  File system directory that contains the user's program groups (which are also file system directories).
CSIDL_RECENT  File system directory that contains the user's most recently used documents.
CSIDL_SENDTO  File system directory that contains Send To menu items.
CSIDL_STARTMENU  File system directory containing Start menu items.
CSIDL_STARTUP  File system directory that corresponds to the user's Startup program group. The system starts these programs whenever any user logs onto Windows NT or starts Windows 95.
CSIDL_TEMPLATES  File system directory that serves as a common repository for document templates.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值