When shbrowseforfolder () is used, the following error occurs:
Cstring browsefolder (hwnd, char * Title, char * displayname)
{
Acdocmanager-> lockdocument (curdoc (), ACAP: kwrite, null, null, true );
Tchar szpath [max_path] = _ T ("");
Browseinfo Bi;
Bi. hwndowner = hwnd;
Bi. pidlroot = NULL;
Bi. lpsztitle = title;
Bi. pszdisplayname = displayname;
Bi. ulflags = bif_returnonlyfsdirs | bif_usenewui;
Bi. lpfn = NULL;
Bi. lparam = 0;
Lpitemidlist pitemidlist = shbrowseforfolder (& BI );
If (pitemidlist)
{
Shgetpathfromidlist (pitemidlist, szpath );
Imalloc * pmalloc;
If (shgetmalloc (& pmalloc )! = Noerror)
{
Trace ("failed to get pointer to shells task Allocator ");
Return szpath;
}
Pmalloc-> free (pitemidlist );
If (pmalloc)
Pmalloc-> release ();
}
Return szpath;
Acdocmanager-> unlockdocument (curdoc ());
}
The value passed to Bi. pszdisplayname must be char *, not "", or null.