Results 1 to 4 of 4

Thread: Create single instance of application Qt 5.4.1 Windows 7 Visual Studio 3013

  1. #1
    Join Date
    Mar 2014
    Location
    USA
    Posts
    85
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Create single instance of application Qt 5.4.1 Windows 7 Visual Studio 3013

    I'm trying to make it so that the program will run only one instance. Preferably if the user tries to open a new instance, it doesn't create a new instance and opens the instance that is already running. All the solutions I have have say use QtSingleApplication, but when I try to include the library, it doesn't exist.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Create single instance of application Qt 5.4.1 Windows 7 Visual Studio 3013

    QtSingleApplication was available in Qt4 (or Qt3) for commercial licensees only. It doesn't seem to have made it through the many ownership changes of Qt since then. I found a replacement on github which might work for you: https://github.com/itay-grudev/SingleApplication
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Mar 2014
    Location
    USA
    Posts
    85
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Create single instance of application Qt 5.4.1 Windows 7 Visual Studio 3013

    I appreciate the feedback. I hate to be a pain, but if possible, I need to find a way to do it within Qt without 3rd party plug-ins for security reasons. Qt has been approved, but it's about a 6 month to one year process to get something new approved. Since QtSingleApplication has been deprecated, anybody know of something I can do?

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Create single instance of application Qt 5.4.1 Windows 7 Visual Studio 3013

    The mirror of the qt-project.org repository is here on git hub. The original Qt Solutions repository, ported to Qt5 and released under LGPL licensing, contains QtSingleApplication and can be found within the qt-project repository.

    It isn't part of the official Qt distribution (and never was - it was always a subscription-only add-on), so I don't know if it also counts as a "3rd party plug-in" under your definition.

    AFAIK, the only way to do what you want is to dip into the Windows API. There is an example on MSDN (google "Limit Single Instance") which uses a cross-process shared mutex. QtSingleApplication does it using a file-locking mechanism (which itself uses a mutex created through the Windows API).
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Single Application Instance
    By BadKnees in forum Qt Programming
    Replies: 8
    Last Post: 4th November 2014, 15:57
  2. Replies: 0
    Last Post: 2nd October 2013, 07:51
  3. Replies: 2
    Last Post: 3rd May 2010, 11:57
  4. Replies: 3
    Last Post: 26th March 2010, 08:26
  5. create .lib using Visual Studio
    By pospiech in forum Qt Programming
    Replies: 6
    Last Post: 28th March 2008, 13:31

Tags for this Thread

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.