Discussion:
Opening an explorer window
(too old to reply)
jmpulido
2009-08-25 10:16:20 UTC
Permalink
I have a wxTreeCtrl with an associated event for double clicks in each
of the tree's nodes, and what I need to do is to open an operating
system explorer window (must be portable between windows and unix),
when an item is double clicked (for example, the node represents a
file and when it is double clicked I want to open the folder
containing the file).

I've been looking for a way to do this in the docs and google but I
didn't find a way to do this, though I'm sure it is possible.

Thanks.
pwb
2009-09-17 09:34:11 UTC
Permalink
On windows, use:

#include <shellapi.h>

...

TCHAR const* dir = ...;
::ShellExecute( NULL, _T("explore"), dir, NULL, NULL, SW_SHOWNORMAL );
Vadim Zeitlin
2009-09-17 15:07:48 UTC
Permalink
Post by jmpulido
I have a wxTreeCtrl with an associated event for double clicks in each
of the tree's nodes, and what I need to do is to open an operating
system explorer window (must be portable between windows and unix),
when an item is double clicked (for example, the node represents a
file and when it is double clicked I want to open the folder
containing the file).
Opening the folders is not currently supported by wx API, we only have
wxLaunchDefaultApplication() which allows you to open the files. Although
maybe wxLaunchDefaultBrowser() might do the right thing, if this would be
more by accident than by design.

Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Continue reading on narkive:
Loading...