Open File Associated to an Application
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Open File Associated to an Application

  1. #1
    Join Date
    Jun 2002
    Posts
    936

    Open File Associated to an Application

    I know how to use WinExec or CreateProcess to run an application. I can also use CreateProcess to open a specific file name within an anpplication.

    What I want, is to open a file that is associated with a specific application, but I don't know the command line or the application installation directory.

    For insance, assume that .txt is associated with another application instead of notepad. Now, when I doubleclick on a text file, is opened by that application rather than notepad.

    All that I want, opening a file with the application that file is associated, but I don't know the application.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,185
    isn't that just executing the file??

    Then your OS checks what program is used...

    I can be wrong!

  3. #3
    Join Date
    Sep 2002
    Location
    14 39'19.65"N / 121 1'44.34"E
    Posts
    9,815

    Re: Open File Associated to an Application

    Originally posted by vcstarter
    All that I want, opening a file with the application that file is associated, but I don't know the application.
    That can be done with ShellExecute() or ShellExecuteEx().

  4. #4
    Join Date
    Jun 2002
    Posts
    936
    ShellExecute Workds fine

  5. #5
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by vcstarter
    ShellExecute Workds fine
    Isn't that in the FAQ? I thought it was. Did you look there first?
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  6. #6
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: Open File Associated to an Application

    Originally posted by vcstarter
    I know how to use WinExec or CreateProcess to run an application.
    Note, that you should not use 'WinExec()' any longer since it is only provided for 16-bit compatibility...
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  7. #7
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Originally posted by Sam Hobbs
    Isn't that in the FAQ? I thought it was. Did you look there first?
    Yes...he could have found the answer easily in the following FAQ...
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center