0

我想知道是否可以用 ANSI C/C++ 编写代码,以便从可执行文件中将我重定向到原始链接。

我在这个对话框上有一个对话框我在这个“关于我”菜单选项中有一个关于我的菜单选项我想要一个指向外部网站的链接,比如 www.google.com。对话框是用 c++ 创建的。例如,

On click of Google->www.google.co.in

这可以使用 acrobat sdk 实现吗?谢谢

4

2 回答 2

2

This is not actually possible in ANSI C/C++ without operating-system specific extensions. So the answer to this question will depend on what operating system you're targetting.

On Linux, recently distributions have been including an xdg-open wrapper script to invoke the default browser. You can use system() or fork() and one of the exec*() family of functions to invoke it.

On Windows, use ShellExecute to open the default browser.

On Mac OS X, use the open CLI call via system or fork() and exec (as in Linux), or you can use the Core Foundation native calls.

On Android, send a browser intent. And on iPhone, there are some calls to open the browser as well.

All of this I got by googling for things like "windows open browser url". I encourage you to try using search engines to find API references in the future; for finding the right API call, this is often a lot faster than asking on stackoverflow.

于 2012-10-04T06:13:48.650 回答
0

如果您想在默认浏览器中打开它,您应该为您的操作系统执行适当的命令。例如,要在 Linux 下的 Firefox 中在新选项卡中打开 Google,您必须执行

firefox -new-tab "http://www.google.com"

这可以通过调用system()函数来完成,例如:

system( "firefox -new-tab \"http://www.google.com\"" );

如果您希望站点出现在您的应用程序中,则必须将浏览器集成到其中。许多现代 IDE 都内置了可以处理基本操作的浏览器小部件,并且可以轻松集成到您的应用程序中。

于 2012-10-04T06:05:21.070 回答