How set SHBrowseForFolder default path to expand My Computer (Win32)

drjackool 956 Reputation points
2022-08-11T04:41:24.553+00:00

Hi
I can set default path SHBrowseForFolder() to folder paths by BFFM_SETSELECTION message but how can I just expand Computer(My Computer/This PC) branch like below photo?
230220-untitled.png

Thanks

Windows development | Windows API - Win32
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 51,456 Reputation points
    2022-08-11T09:02:11.597+00:00

    In terms of the shell obtain the pidl of the known folder (FOLDERID_ComputerFolder) and assign it to the BROWSEINFO structure member pidlRoot. Then SHBrowseForFolder returns this (Win10 21H1) -

    230392-browser.png


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.