SHFILEOPERATION nach CFILEDIALOG mit ALLOWMULTISELECT



  • Hi,

    ich würd gerne folgende besondere Möglichkeit von SHFILEOPERATION nutzen:
    pFrom ist doppelt genullter String

    kann mir jemand sagen ob ich bei Beenden vom CFileDailog mit ALLOWMULTISELECT das irgendwie nutzen kann?

    Laut Onlinehilfe geht`s:

    If m_ofn.Flags has the OFN_ALLOWMULTISELECT flag set, this string contains a sequence of null-teminated strings, with the first string being the directory path of the file group selected, followed by the names of all files selected by the user

    Hab mir das ungefähr so vorgestellt:

    int copyFiles(CString &rPath)
    {
    	CString strFilter;
    	strFilter = _T("Alle-Dateien (*.*)|*.*|");                       
    
    	CFileDialog m_ldFile (true, "", "", OFN_FILEMUSTEXIST | OFN_EXPLORER | OFN_ALLOWMULTISELECT, strFilter);
    	m_ldFile.m_ofn.lpstrInitialDir = rPath;
    
    	if (m_ldFile.DoModal() == IDOK)
    	{
    		SHFILEOPSTRUCT shfs;
    		shfs.hwnd   = NULL;
    		shfs.wFunc  = FO_COPY;
    		shfs.pFrom  = [u][b]m_ldFile.GetPathName();[/b][/u]
    		shfs.pTo    = "C:\\temp";
    		shfs.fFlags = NULL;
    
    		if (!SHFileOperation(&shfs))
    			return 0; // Alles OK
    		else
    			retrun 1;
    	}
    	else
    		return 1;
    }
    

    Viele Grüße



  • Das geht leider nicht, da das CFileDialog ja einen "String" der Form:

    "c:\Pfad\0Name1\0Name2\0Name3\0\0"

    liefert, aber das SHFILEOPSTRUCT sowas will:

    "C:\Pfad\Name1\0C:\Pfad\Name2\0C:\Pfad\Name3\0\0"

    Somit musst Du es ummappen...



  • Alles klar, danke für Deine Antwort 🙂


Anmelden zum Antworten