Click to See Complete Forum and Search --> : [RESOLVED] Emulating an Explorer double click from within my own app


spartygw
May 2nd, 2008, 03:09 PM
Hi all. I am writing an application in wxWidgets for XP and Vista. Part of this application includes a tree control listing some files on the drive.

What I want to be able to do is when I trap a double click event on one of my tree items, I want to "open" that file in the same fashion that Explorer would use if the user dbl clicked on the same file.

My background is in UNIX so I'm slow with Windows-specific stuff. So far all I've figured out how to do is lookup in the registry the PersistentHandler for my file based on the extension.

The PersistentHandler is some ID I guess. How can I get the actual executable fullpathname from this ID?


Edit: Is there an easier way (some unknown Win func call?) for me to just have Windows sort all this out for me or is all this lookup in the registry the best way? E.g., ExplorerExecute(myFile)? :) That would be too easy.

-gw

MrViggy
May 2nd, 2008, 03:19 PM
ShellExecute (http://msdn.microsoft.com/en-us/library/bb762153.aspx) is what you're looking for.

Viggy

spartygw
May 2nd, 2008, 03:30 PM
Good gosh, that is amazing! :) It took me longer to compose the question than for you to respond with the exact answer I had been googling for for hours.

I just implemented it in my code and it works beautifully! Thanks a ton!

-gw

MrViggy
May 2nd, 2008, 04:07 PM
No prob. If you're going to be doing more Windows specific things, you might consider a good Windows API reference book.

The MSDN (http://msdn.microsoft.com) is pretty good, but sometimes you have to kinda know what your looking for, more specifically then your original question. ;)

Vig.

spartygw
May 2nd, 2008, 04:14 PM
Mr Viggy, thanks.

Yeah I'm finding the MSDN documentation is surprisingly good, it's just a matter of drilling down to the actual page I need! Grrr.

Tons of thanks again. I'm new to the website but will definitely contribute where there's a topic I can actually answer!

-gw

fred100
May 2nd, 2008, 09:05 PM
i had been googling for for hours.


???
ShellExecute() is a Usenet FAQ, that everyone knows as it returns 78 700 hits (!) in Google Groups

spartygw
May 2nd, 2008, 09:22 PM
Sure it returns all those hits if you know to search on the string "ShellExecute".

That was my point about MSDN. The documentation is there, it's just finding the proper search phrase to find it.

-gw