• 4364阅读
  • 5回复

[提问]CreateProcess打开指定网页但打开的是空白页 [复制链接]

上一主题 下一主题
离线moiit
 

只看楼主 倒序阅读 楼主  发表于: 2012-03-06
  1. STARTUPINFO start_info;
  2.     PROCESS_INFORMATION proc_info;
  3.     ::ZeroMemory(&start_info, sizeof(start_info));
  4.     start_info.cb = sizeof(start_info);
  5.     ::ZeroMemory(&proc_info, sizeof(proc_info));
  6.     
  7.     LPCTSTR browser = L"C:/Program Files/Internet Explorer/iexplore.exe";
  8.     LPTSTR command_line = L"http://sohu.com";
  9.     ::CreateProcess(browser, command_line, NULL, NULL, FALSE, 0, NULL, NULL, &start_info, &proc_info);
  10.     if (proc_info.hThread != NULL) {
  11.       ::CloseHandle(proc_info.hThread);
  12.     }
  13.     if (proc_info.hProcess != NULL) {
  14.       ::CloseHandle(proc_info.hProcess);
  15.     }

烦请指点问题出在哪儿?
谢谢!
离线wxj120bw

只看该作者 1楼 发表于: 2012-03-06
回 楼主(moiit) 的帖子
看下msdn对CreateProcess函数第六个参数的说明
离线moiit

只看该作者 2楼 发表于: 2012-03-07
对不起,请恕我愚钝,我不知道这个参数的该怎么设定。
能否具体指出该设成什么。谢谢!
离线wxj120bw

只看该作者 3楼 发表于: 2012-03-07
回 2楼(moiit) 的帖子
msdn的对这个参数的说明
dwCreationFlags [in]
    The flags that control the priority class and the creation of the process. For a list of values, see Process Creation Flags.
对Process Creation Flags一个值的说明
CREATE_PRESERVE_CODE_AUTHZ_LEVEL 0x02000000
Allows the caller to execute a child process that bypasses the process restrictions that would normally be applied automatically to the process.
PS:没有试验过
离线xuweistudy
只看该作者 4楼 发表于: 2012-03-07
QDesktopServices::openUrl()
离线moiit

只看该作者 5楼 发表于: 2012-03-07
网上查到的解决方案:在command_line里最前面加空格。
真的管用。
谢谢各位!
快速回复
限100 字节
 
上一个 下一个