-1

I wanted to know if it is possible to write code in ANSI C/C++ so that from an executable i should be redirected to the original link.

I have a dialog box on this dialog box i have a about me menu option in this " about me " menu option i want to have a link to an external website say www.google.com.The dialog box is created in c++. For example,

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

Can this be possible using acrobat sdk? Thanks

Linda Harrison
  • 257
  • 1
  • 3
  • 14
  • Can you please extend your question? To me, at least, it is not clear what you try to achieve. – JohnB Oct 04 '12 at 06:02
  • The acrobat SDK is not going to be of any help here. Why do you bring it up? – bdonlan Oct 04 '12 at 06:20
  • possible duplicate of [making a weblink work from a dialog box in adobe reader](http://stackoverflow.com/questions/12705266/making-a-weblink-work-from-a-dialog-box-in-adobe-reader) – JoeG Oct 04 '12 at 06:23

2 Answers2

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.

Community
  • 1
  • 1
bdonlan
  • 224,562
  • 31
  • 268
  • 324
0

If you want to open it in the default browser, you should execute an appropriate command for your OS. For example, to open Google in Firefox under Linux in a new tab, you will have to execute

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

This can be done via a call to the system() function, e.g.:

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

If you want the site to appear inside of your application, you will have to integrate the browser into it. Many modern IDEs have built-in browser widgets that can handle basic operations, and can be easily integrated into your app.

SingerOfTheFall
  • 29,228
  • 8
  • 68
  • 105