CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2008
    Posts
    24

    [RESOLVED] Emulating an Explorer double click from within my own app

    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
    Last edited by spartygw; May 2nd, 2008 at 03:12 PM. Reason: Add more info

  2. #2
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Emulating an Explorer double click from within my own app

    ShellExecute is what you're looking for.

    Viggy

  3. #3
    Join Date
    May 2008
    Posts
    24

    Re: Emulating an Explorer double click from within my own app

    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

  4. #4
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Emulating an Explorer double click from within my own app

    No prob. If you're going to be doing more Windows specific things, you might consider a good Windows API reference book.

    The MSDN is pretty good, but sometimes you have to kinda know what your looking for, more specifically then your original question.

    Vig.

  5. #5
    Join Date
    May 2008
    Posts
    24

    Re: Emulating an Explorer double click from within my own app

    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

  6. #6
    Join Date
    Jan 2008
    Posts
    178

    Re: Emulating an Explorer double click from within my own app

    Quote Originally Posted by spartygw
    i had been googling for for hours.
    ???
    ShellExecute() is a Usenet FAQ, that everyone knows as it returns 78 700 hits (!) in Google Groups

  7. #7
    Join Date
    May 2008
    Posts
    24

    Re: Emulating an Explorer double click from within my own app

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured