Results 1 to 6 of 6

Thread: How to restrict running of more than one instance of application's exe in Qt?

  1. #1
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up How to restrict running of more than one instance of application's exe in Qt?

    Hi Friends,

    I am using Qt 4.2 in Windows, I am creating one application in Qt, I want to restrict my user to run more than one exe of my application,
    Is there any method to do this?

    Please Help me.

    Thanks,
    Rajesh.S

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to restrict running of more than one instance of application's exe in Qt?

    I you own a Qt commercial license you can have a look at Qt solutions : there's a QtSingleApplication.

    However if you want an open-source solution you may be interested in the little class I've crafted : QSingleApplication it uses a temp file and local networking through TCP/IP to check whether an instance is already running and is able to communicate with the existing instance if any
    Current Qt projects : QCodeEdit, RotiDeCode

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

    rajeshs (5th July 2007)

  4. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to restrict running of more than one instance of application's exe in Qt?

    J-P Nurmi

  5. #4
    Join Date
    Jan 2007
    Location
    Augsburg, Germany
    Posts
    75
    Thanks
    4
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to restrict running of more than one instance of application's exe in Qt?

    With the ActiveQt module you could also use QAxFactory::registerActiveObject()

  6. #5
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: How to restrict running of more than one instance of application's exe in Qt?

    Quote Originally Posted by fullmetalcoder View Post
    I you own a Qt commercial license you can have a look at Qt solutions : there's a QtSingleApplication.

    However if you want an open-source solution you may be interested in the little class I've crafted : QSingleApplication it uses a temp file and local networking through TCP/IP to check whether an instance is already running and is able to communicate with the existing instance if any


    Ok please send that singleapplication implementation , i am interested on that ..


    Thanks
    Rajesh.S

  7. #6
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to restrict running of more than one instance of application's exe in Qt?

    Well I've not packaged anything so you'll have to rely on SVN... Just do a checkout of : https://edyuk.svn.sf.net/svnroot/edy...dparty/qcumber All the code resides there (but there are also unrelated classes...) in QSingleApplication, QInterProcessChannel, QManagedSocket and QManagedRequest. The only class you need to know about, for most usess, is QSingleApplication. Just create one instead of a QApplication (or subclass it instead of subclassing directly QApplication) then check isInstanceAllowed() before calling exec() and you're done...
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. Replies: 5
    Last Post: 16th January 2006, 05: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.