Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. SHGetSpecialFolderLocation error !!!

SHGetSpecialFolderLocation error !!!

Scheduled Pinned Locked Moved C / C++ / MFC
helpdata-structuresannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fredb45
    wrote on last edited by
    #1

    I want to retrieve icon like "my documents" in explorer but ... My init function: CShellUtil::CShellUtil() { SHFILEINFO shFinfo; HIMAGELIST hImgList = NULL; LPITEMIDLIST itemlist = 0; bError=FALSE; if (SHGetSpecialFolderLocation(0, SIDL_DESKTOP , &itemlist) == NOERROR) { hImgList = (HIMAGELIST)SHGetFileInfo((LPCTSTR) itemlist, 0, &shFinfo, sizeof(shFinfo ), SHGFI_SYSICONINDEX | SHGFI_PIDL | SHGFI_SMALLICON ); if(!hImgList) { bError=TRUE; return; } m_SysImgList.m_hImageList=hImgList; } else { bError=TRUE; return; } Function to display icon into Tree HTREEITEM CShellUtil::AddSpecialItem(HTREEITEM hParent, int nFolder) { SHFILEINFO shFinfo; int iIcon; BOOL bIsCDROM=FALSE; HTREEITEM hItem; LPITEMIDLIST pIDL; LPMALLOC pMem; if(SHGetSpecialFolderLocation(NULL, nFolder, &pIDL) == NOERROR) { if(SHGetFileInfo((LPCTSTR)pIDL, 0, &shFinfo, sizeof(shFinfo), SHGFI_DISPLAYNAME | SHGFI_PIDL | SHGFI_ICON | SHGFI_SMALLICON)) { if(SHGetMalloc(&pMem)==NOERROR) { pMem->Free(pIDL); pMem->Release(); } } } Icon = shFinfo.iIcon; hItem=m_TreeCtrl.InsertItem(_T("Test"), iIcon, iIcon, hParent); return hItem; } When i call 'AddSpecialItem', it's OK to insert special folder from "CSIDL_DESKTOP" to "CSIDL_STARTMENU" and from "CSIDL_DESKTOPDIRECTORY" to "CSIDL_LOCAL_APPDATA"-> DislplayName and Icon are OK But there is a problem from "CSIDL_MYDOCUMENTS" to "CSIDL_MYVIDEO" No icon and no display name and SHGetSpecialFolderLocation(..) return an error I try with if(SHGetFolderLocation(NULL, nFolder, NULL, 0, &pIDL) == S_OK) but no success (return E_INVALIDARG) I use lib from microsoft SDK august 2001 on win2000 Sp2 plateform with visual sp5 Please help

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups