Win32API's ShellExtension shell extension provides this way. Here is a C language
The written program can display the dialog shown above. VoidselectDirdlg (Chardir [])
{
Browseinfobi;
ItemidList * PIDL;
bi.hwndowner = null;
Bi.PIDLROOT = NULL;
Bi.pszdisplayName = DIR;
Bi.lpsztitle = "Selectadirectory";
Bi.ulflags = Bif_Returnonlyfsdirs;
bi.lpfn = null;
bi.lparam = 0;
bi.iimage = 0;
PIDL = shbrowseforfolder (& BI); / * Display "SelectFolder" DIA
Logbox, Getthe
FoldernameAndConvertit
INTOAITEMLIST
DataStructure. * /
IF (PIDL == Null)
DIR [0] = 0;
IF (! SHGETPATHFROMIDLIST (PIDL, DIR)) / * RetrieveFoldernam
efromitemlist
Structure. * /
DIR [0] = 0;
}