Results 1 to 4 of 4

Thread: Run application by opening file

  1. #1
    Join Date
    Dec 2010
    Posts
    20
    Thanks
    9
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Run application by opening file

    I don't really know how to explain this..

    I use windows 7 platform
    I make an application whose output is a file (consider *.asd). What I want to do is, if I double click this file, my application will run and open this file.

    To simplify, I want to make my application's behavior like *.xls in microsoft excel. When I open *.xls file, microsoft excel automatically run and open this file.

    Anyone got any suggestions?

    Sorry for poor english

  2. #2
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Run application by opening file

    This is a Windows issue, not a Qt issue. You need to register the file extension and associate it with the executable to be run when a file with that extension is double-clicked.

    I don't recall the exact steps, but basically you right-click a file and select "open", which will bring up an error dialog and give you a choice to select an application to run the file with and whether you want that association to be permanent.

  3. The following user says thank you to SixDegrees for this useful post:

    rivci (2nd March 2011)

  4. #3
    Join Date
    Dec 2010
    Posts
    20
    Thanks
    9
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Run application by opening file

    Done, when I double click the file, my application runs.

    But my file's data is not loaded.. how should I pass this file to my application?

  5. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Run application by opening file

    That depends on how you configured the OS to pass the filename to your application when you created the association. Did you request the filename as part of the command line parameters, or as a DDE request? The second is typically done so that if your application is already running another copy is not started, but rather you are sent a message detailing the file open request.

Similar Threads

  1. Opening a program instead of a file
    By jaybstory in forum Newbie
    Replies: 4
    Last Post: 14th January 2010, 04:33
  2. Launch app by opening a file
    By Windsoarer in forum Qt Programming
    Replies: 2
    Last Post: 28th May 2009, 06:22
  3. Problem in opening a file
    By Abc in forum Qt Programming
    Replies: 2
    Last Post: 12th August 2008, 12:40
  4. Opening pdf file in Qt application
    By jyoti kumar in forum Qt Programming
    Replies: 2
    Last Post: 20th June 2007, 18:35
  5. Opening file
    By Salazaar in forum Newbie
    Replies: 5
    Last Post: 5th June 2007, 18:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.