wxExecute?

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
Anthony11
Knows some wx things
Knows some wx things
Posts: 30
Joined: Sun Jul 05, 2015 7:14 am

wxExecute?

Post by Anthony11 »

Code: Select all

wxExecute("help\\documentation.chm");
also tried

Code: Select all

wxExecute(".\\help\\documentation.chm");
shows messagebox (error 0)
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxExecute?

Post by doublemax »

These are not executable files. The one who opens the correct application when you open them is Windows Explorer.

In wxWidgets use wxLaunchDefaultApplication:
http://docs.wxwidgets.org/trunk/group__ ... f82b2d66c3
Use the source, Luke!
User avatar
whoops
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sat Jun 27, 2015 5:53 am
Location: China

Re: wxExecute?

Post by whoops »


you can simply using the following code:

Code: Select all

// ...
	const char *helpFile = "help\\documentation.chm";
	bool executed = wxShell(helpFile);
	if ( !executed )
		wxLogDebug( wxString::Format(wxT("Failed to open \"%s\""), helpFile) );
// ...
here is the documentation on wxShell
bool wxShell ( const wxString & command = wxEmptyString )
Executes a command in an interactive shell window.
If no command is specified, then just the shell is spawned.

See Also
wxExecute(), External Program Execution Sample

Include file:
#include <wx/utils.h>
so, you know "documentation.chm" isn't a execution sample
[/size]
 Things being equal, the simplest explanation tends to be the right.

 [ Windows 7 Ultimate x64 | wxWidgets 3.0.2 | Microsoft Visual C++ 2010 Express ]
Post Reply