Launching The Default Browser
From WxWiki
Contents |
[edit] Launching the Default Browser
With wxWidgets versions 2.6 and up you can use wxLaunchDefaultBrowser.
[edit] Versions below 2.6
Keywords: wxExecute browser url
Julian published this Code To View A HTML File on the mailinglists. Functionality like this is on the wishlist for a later version of wxWidgets. (Note: this does not work with KDE 3.2!)
There is also wxHyperlinksCtrl class from Angelo Mandato at http://www.spaceblue.com/codedetail.php?CodeID=7
[edit] Using Mimetypes
I haven't tested this for html files, but wouldn't this simply work?
wxMimeTypesManager manager;
wxFileType * filetype = manager.GetFileTypeFromExtension("txt");
wxString command = filetype->GetOpenCommand("pathalizer.events");
wxExecute(command);
(add error handling yourself ;))
[edit] Windows and UNIX
The ClickableURL::OpenInBrowser() function at http://mahogany.svn.sourceforge.net/viewvc/mahogany/trunk/M/src/gui/ClickURL.cpp?view=markup (Thanks to Vadim)
[edit] Mac
Semi-working Mac code: http://cocoa.mamasam.com/COCOADEV/2002/09/2/45230.php (Thanks to arkanes)
and also: Carbon Code To Open URLs On WxMac (Thanks to Aj Lavin)
You could also use the "open" command with wxExecute to open the default webbrowser for a file/url. Try this on the command-line (Applications/Utilities/Terminal)
% open "http://www.wxwidgets.org"
This will only work on OS X.
