Failed to delete file using ShellExecuteW
https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew
If the function succeeds, it returns a value greater than 32. If the function fails, it returns an error value that indicates the cause of the failure.
the return value of my ShellExecuteW code is 42, according to documentation the code is success but the file isn't deleted.
I found a solution. I change the code into this:
string ReportBacktestName = "/C del ATR_X_CCIColorLevel*"+CurrentSymbol+"*"+tradeDirection+"*Report.xml"; string BacktestLocationPath = sTerminalTesterDataPath+"\\MQL5\\Files\\Reports\\"+StrategyCategory+"\\"+StrategyName+"\\"; ShellExecuteW(0, "open", "cmd.exe", ReportBacktestName, BacktestLocationPath, 0);
note this part.
Hi, I want to delete file using ShellExecuteW like code below but failed to launch cmd to delete the file. Anyone knows the problem?