Ich verwende folgenden Code:
Problem:
Die Ordnerauswahl beginnt immer mit dem Desktop-Ordner
Ich möchte aber einen anderen Ordner noch vor dem Aufruf der Funktion vorgeben.
Die msdn sagt:
Wie komm ich an die PIDL eines Ordners ?
Damit ihr wiss wies gemeint ist:
Diese Funktion macht genau das Gegenteil von dem was ich suche:
SHGetPathFromIDList(pidl, displayname);
Code:
void CDeveloperDlg::OnButtChoosproj()
{
BROWSEINFO bi; //watch msdn.microsoft.com Inforamtion aboute BROWSEINFO-Structure
LPITEMIDLIST pidl; //takes Returnvalue of SHBrowseForFolder(&bi) as Pointer to Identifierlist
char displayname[MAX_PATH]; //takes extracted PathName as String
bi.hwndOwner = GetSafeHwnd();
bi.pidlRoot = NULL;
bi.pszDisplayName = displayname;
bi.lpszTitle = NULL;
bi.ulFlags = BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
bi.iImage = 0;
pidl = SHBrowseForFolder(&bi); //Returns NULL if User cancles
if (pidl) {
SHGetPathFromIDList(pidl, displayname);
m_sProjPath = ("%s",displayname);
UpdateData(FALSE);
LPMALLOC lpMalloc; //free Memory
SHGetMalloc( &lpMalloc );
lpMalloc->Free( pidl );
}
}
Problem:
Die Ordnerauswahl beginnt immer mit dem Desktop-Ordner
Ich möchte aber einen anderen Ordner noch vor dem Aufruf der Funktion vorgeben.
Die msdn sagt:
pidlRoot
Pointer to an item identifier list (PIDL) specifying the location of the root folder from which to start browsing. Only the specified folder and any subfolders that are beneath it in the namespace hierarchy will appear in the dialog box. This member can be NULL; in that case, the namespace root (the desktop folder) is used.
Wie komm ich an die PIDL eines Ordners ?
Damit ihr wiss wies gemeint ist:
Diese Funktion macht genau das Gegenteil von dem was ich suche:
SHGetPathFromIDList(pidl, displayname);