Results 1 to 20 of 23

Thread: QT app Run once

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: QT app Run once

    Well that's why you use Qt over MFC, because you don't have to code architecture specific components. If one purchase a Qt license he could expect to have this crucial feature out of the box.

    Correct me if I'm wrong but QtSinglaApp feels more like : "Too bad you need to pay extra bucks for doing that crucial feature".
    Instead of
    "It's so complicated to develop we've decided to charge you more".

    Anyway, thanks for the help guys .

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT app Run once

    If one purchase a Qt license he could expect to have this crucial feature out of the box.
    It is not a crucial feature. You just feel like that because you need it right now.
    If you'd have started to implement your own last night when you first asked about it, it would have been ready right now. Twice .

  3. #3
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: QT app Run once

    Quote Originally Posted by marcel View Post
    It is not a crucial feature. You just feel like that because you need it right now.
    If you'd have started to implement your own last night when you first asked about it, it would have been ready right now. Twice .
    I guess that's the difference between you and me marcel. I'm taking one week to develop such a feature :-).

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QT app Run once

    Quote Originally Posted by bunjee View Post
    I guess that's the difference between you and me marcel. I'm taking one week to develop such a feature :-).
    But why? It shouldn't. I find it very useful that Trolltech offered some insight on how QtSingleApplication was implemented. Once you had this information, the Internet is full of documentation on FindWindow and WM_COPYDATA, and the other methods used on the other platforms.

  5. The following user says thank you to marcel for this useful post:

    bunjee (13th February 2008)

  6. #5
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: QT app Run once

    Right,
    I'll take a look and I'll post my home-made implementation.

    And guess what ? It'll be free.

  7. #6
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QT app Run once

    Anybody knows where can I get first parameter for FindWindow function? It is registered window class name and I don't know how to obtain it
    C++ & AMD forever

  8. #7
    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: QT app Run once

    Just as docs say, use RegisterClass(). If title is enough, you can do:
    Qt Code:
    1. WId QxtWindowSystem::findWindow(const QString& title)
    2. {
    3. std::wstring str = title.toStdWString();
    4. return ::FindWindow(NULL, str.c_str());
    5. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  9. #8
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QT app Run once

    It's funny today I've asked two questions and 5 minutes after I've found a solution myself
    But I suppose that hardcoding window name is not the best idea...
    I've done it like this
    Qt Code:
    1. wchar_t *str = new wchar_t[16];
    2. mbstowcs(str,"My Window Title", 16 );
    3. qDebug()<<"------------------------------------";
    4. qDebug()<<FindWindow(0, str);
    5. qDebug()<<"------------------------------------";
    To copy to clipboard, switch view to plain text mode 
    But anyway thanks jpn
    C++ & AMD forever

  10. #9
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QT app Run once

    Does anybody know how to implement run once application on Mac OS X ? In the docs on QSingleApplication I've read that they use "named ports". Anyone knows what is it ? Some links would be very useful...
    C++ & AMD forever

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
  •  
Qt is a trademark of The Qt Company.