*/
void wxRegisterId(long id);
+/**
+ Opens the @a document in the application associated with the files of this
+ type.
+
+ The @a flags parameter is currently not used
+
+ Returns @true if the application was successfully launched.
+
+ @header{wx/utils.h}
+*/
+bool wxLaunchDefaultApplication(const wxString& document, int flags = 0)
+
/**
Opens the @a url in user's default browser.
// Launch document with default app
// ----------------------------------------------------------------------------
-bool wxLaunchDefaultApplication(const wxString &document, int flags)
+bool wxLaunchDefaultApplication(const wxString& document, int flags)
{
wxUnusedVar(flags);
-#ifdef __UNIX__
+#if defined(__UNIX__)
// Our best best is to use xdg-open from freedesktop.org cross-desktop
// compatibility suite xdg-utils
// (see http://portland.freedesktop.org/wiki/) -- this is installed on
if ( wxExecute(xdg_open + " " + document) )
return true;
}
+#elif defined(__WXMSW__)
+ const INT_PTR result = (INT_PTR)::ShellExecute
+ (
+ NULL, // parent window
+ _T("open"),
+ document,
+ NULL, // parameters
+ NULL, // working directory
+ SW_SHOWDEFAULT
+ );
+ if ( result > 32 )
+ return true;
#endif
- return false;
+ return false;
}
// ----------------------------------------------------------------------------