Open local html file with parameters in default broswer on windows

后端 未结 1 1509
鱼传尺愫
鱼传尺愫 2021-01-14 02:50

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,

相关标签:
1条回答
  • 2021-01-14 03:25

    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);
    }
    
    0 讨论(0)
提交回复
热议问题