Why hassle with DLL calls? If you want to delete files in the normal "Files" sandbox, just use FileDelete.
It's not in normal "Files" sandbox though. I have 2 MT5 one for trading the other for optimization (not always active). I want to delete files from the MT5 optimization.
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.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, I want to delete file using ShellExecuteW like code below but failed to launch cmd to delete the file. Anyone knows the problem?