SHFileOperation tut nicht
-
Was sagt GetLastError()?
-
@:-))),
ja das ist ja das komische.
Folgende unschöne Lösung funktioniert auch:system( "rmdir /S /Q c:\Dokumente und Einstellungen\..." );jedoch geht das ganze so nicht:
WinExec( "rmdir /S /Q c:\Dokumente und Einstellungen\...", SW_SHOW );Ich verstehe das ganze nicht wirklich.
-
ist ja wohl klar. da sind leerzeichen im pfad. musst den pfad quoten.
-
@Luckie,
wenn ich mir von SHFileOperation die Fehlerboxen anzeigen lasse, bekomme ich folgende Meldung: Datei kann nicht gelöscht werden: Die Quelldatei oder vom Quelldatenträger kann nicht gelesen werden.
-
@:-)))), stimmt...habe bei mir auch " um den Pfad herum.
-
Zeig doch einfach deinen Code.
-
static bool CInstaller::DeleteDir( string sPath ); ... bool CInstaller::DeleteDir( string sPath ) { SHFILEOPSTRUCT fs; ZeroMemory( &fs, sizeof( SHFILEOPSTRUCT ) ); fs.wFunc = FO_DELETE; fs.pFrom = sPath.c_str(); // Ohne das Flag bekomme ich die Fehlermeldung fs.fFlags = FOF_SILENT; if ( !SHFileOperation( &fs ) ) return true; return false; }; ... ... string sPath = "C:\\Dokumente und Einstellungen\\All Users\\Sta.... // DeleteDir und gibt immer false zurück CInstaller::DeleteDir( sPath );
-
An additional NULL character must be appended to the end of the final name to indicate the end of pFrom.
-
???????? schrieb:
An additional NULL character must be appended to the end of the final name to indicate the end of pFrom.
mist genau das selbe wollte ich auch schreiben, hatten wir diese woche schon mal.
-
Bei mir funktioniert das:
#include <windows.h> #include <shellapi.h> int main() { SHFILEOPSTRUCT fs; ZeroMemory( &fs, sizeof( SHFILEOPSTRUCT ) ); fs.wFunc = FO_DELETE; fs.pFrom = "C:\\Dokumente und Einstellungen\\All Users\\Startmenü\\Programme\\MeinProgramm"; fs.fFlags = FOF_SILENT; SHFileOperation( &fs ); }
-
Juhu...das wars. Wieder etwas gelernt

-
Wieder was gelernt? Lern mal Doku lesen.