Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open local html file with parameters in default broswer on windows

I need to open html file on disk with parameters from within my C++ program in default browser.

For example: c:\index.html?id=15 .

I am using ShellExecute, to open all urls or files, but this one does not work, it strips parameters from local files.

ShellExecute(0, NULL, "file:///c:\index.html?id=15", NULL, NULL, SW_SHOWNORMAL);

It works fine from command line i.e. iexplore file:///c:\index.html?id=15

How can I open that page?

like image 309
Roman Avatar asked Nov 03 '22 22:11

Roman


1 Answers

Please try this code.

int result = 0;
TCHAR app[MAX_PATH] = { 0 };

result = (int)::FindExecutable(_T("C:\\index.html"), NULL, app);
if (result > 32) {
  ::ShellExecute(0, NULL, app,
     _T("file:///C:\\index.html?id=15"), NULL, SW_SHOWNORMAL);
}
like image 71
Status BreakPoint Avatar answered Nov 09 '22 13:11

Status BreakPoint