In one of my programs I am using rundll32.exe url.dll,FileProtocolHandler c:\path\to\a.file
to open files. I would like to handle errors in case this file could not be opened but I can't figure out how to find out if there was an error or not.
That's my code:
QProcess::startDetached( QString( "rundll32.exe url.dll,FileProtocolHandler " + p_target_path ) );
startDetached()
now always returns true, because it's always succesfull in opening a process containing rundll32.exe. So how do I know if my file could be found/opened or not?
I tried errorlevel-things in a *.bat file for testing.
rundll32.exe url.dll,FileProtocolHandler c:\not_existing.exe >nul || echo Could not open file.
But there is nothing being echoed. I also tried to read the %ERRORLEVEL%, but even if the file is not existing the errorlevel remains 0.
Does anyone know a way to find out how to deal with this?