使用ShellExecuteEx时如何使用相同的浏览器选项卡 [英] how do I use the same browser tab when using ShellExecuteEx

查看:80
本文介绍了使用ShellExecuteEx时如何使用相同的浏览器选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows机器上使用以下代码启动浏览器以显示我的程序的html帮助(html页面)。 html页面位于远程硬盘上。



位于班级的创建方法中:

 shellexecuteInfo.cbSize =  sizeof (SHELLEXECUTEINFO); 
shellexecuteInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
shellexecuteInfo.lpVerb = open;
shellexecuteInfo.nShow = SW_SHOWNORMAL;
shellexecuteInfo.lpDirectory = 0 ;
shellexecuteInfo.hInstApp = 0 ;





每当我需要显示新的帮助主题时使用:

 shellexecuteInfo.lpFile = path.c_str(); 
bool isSuccess = ShellExecuteEx(& shellexecuteInfo);



在我的程序中,我有几种方法让用户直接转到一个主题,我通过更改std :: string路径变量来实现。这很好用。但是,每次我执行ShellExecuteEx时,浏览器都会打开一个新选项卡。有什么方法可以让它重新使用它最初创建的选项卡吗?

解决方案

它与C ++ 11或的ShellExecuteEx 。 OS及其shell都没有tab这样的概念,这只是浏览器的内部功能,取决于浏览器。可以使用命令行启动进程,无论如何都是如此。并且一些命令行参数可能会或可能不会描述您启动的应用程序要考虑的一些数据。其他一切都取决于应用程序如何处理。



你可以参考浏览器的文档,但是......即使它适用于一个浏览器,它也行不通与另一个。



-SA


好的,我想我应该查看WebBrowser类。

I'm using the following code on a windows machine to launch a browser to show html help (html pages) for my program. The html pages are located on a remote hard drive.

Located in the class's creation method:

shellexecuteInfo.cbSize = sizeof(SHELLEXECUTEINFO);
shellexecuteInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
shellexecuteInfo.lpVerb = "open";
shellexecuteInfo.nShow = SW_SHOWNORMAL;
shellexecuteInfo.lpDirectory = 0;
shellexecuteInfo.hInstApp = 0;



used whenever I need to show a new help topic:

shellexecuteInfo.lpFile = path.c_str();
bool isSuccess = ShellExecuteEx(&shellexecuteInfo);


In my program I have several ways for the user to go directly to a topic, which I implement by changing the std::string path variable. This works fine. However, every time I do a ShellExecuteEx, the browser opens up a new tab. Is there any way I can make it re-use the tab it originally created?

解决方案

It has nothing to do with C++11 or ShellExecuteEx. Neither OS nor its shell has such concept as "tab", this is just the internal feature of a browser and depends on browser. A process can be started with command line, that's all, no matter how. And some command line parameters may or may not describe some data to be taken into account by the application you start. Everything else depends on how to the application deals with that.

You can refer the browser's documentation, but… even if it works with one browser, it won't work with another one.

—SA


OK, I guess I should look into the WebBrowser class.


这篇关于使用ShellExecuteEx时如何使用相同的浏览器选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆