I am coding in Metatrader and using ShellExecuteW to open a local browser with a html file that is written within Metatrader.
All works perfectly except when the directory that a user has his Metatrader platform installed in is a split name directory. ie: My FX and not MyFx.
If it is MyFx, there are no problems at all and the browser opens as intended showing the html file.
When the split name is used, it will try to open at eg: file:///G:/My and never see the rest of the address.
Relevant code as it stands is below. The user only puts in the name of the file eg: VisualizeV1 which is why there is the concatenation etc but that is not the issue.
string newtpath = TerminalPath() ;
// outputs G:\MyFX
string MT4_file_folder =newtpath+"/MQL4/Files/";
// outputs G:\MyFX/MQL4/Files/
filesuffix=StringConcatenate("_",Symbol(),"_",TimeFrameStr,"_",fname_rpt_date);
// Outputs BrookyVisualize/VisualizeV1___EURUSD_H1__yr2014_mth6_dy19_hr23
fname=StringConcatenate(filename,filesuffix,".html");
// Outputs BrookyVisualize/VisualizeV1___EURUSD_H1__yr2014_mth6_dy19_hr23.html
file2find=StringConcatenate("file://",MT4_file_folder,visualize_folder,fname);
// Outputs G:\MyFX/MQL4/Files/BrookyVisualize/VisualizeV1___EURUSD_H1__yr2014_mth6_dy19_hr23.html
ShellExecuteW(0,NULL,Your_Internet_Browser,file2find,NULL,5);
// Opens firefox at address file:///G:/MyFX/MQL4/Files/BrookyVisualize/VisualizeV1___EURUSD_H1__yr2014_mth6_dy19_hr23.html
I have tried replacing the missing characters in the directory with   and  . Also wildcard * and forward slashes.
If the replacements are inserted, the address is generated and opens in the browser as eg: file:///G:/My  FX/MQL4/ ...... which then gives a file not found error.
Could someone please advise what I should pass into ShellExecuteW re this path to resolve this issue.
Thank you.