Results 1 to 3 of 3

Thread: How to Know if our Qt application has focus from other No QT application

  1. #1
    Join Date
    Aug 2010
    Posts
    20
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default How to Know if our Qt application has focus from other No QT application

    Hello,

    I have a Qt application with severals views ( QWidgets ).
    I have a windows service and when same event arrives I must check if any view of the Qt Application has the focus.

    At first I try to compare with handles obtained with:

    GetForegroundWindow() == FindWindow(L"MyApp",0)

    But this fails and FindWindows return NULL.

    I think that I miss so set something in QtApplication But I can't Find what could be
    Thanks in advance

    Juan Manuel

  2. #2
    Join Date
    Sep 2010
    Posts
    145
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 18 Times in 17 Posts

    Default Re: How to Know if our Qt application has focus from other No QT application

    You need to use the lpWindowName parameter instead of lpClassname, since you know what the title of your window is and have no idea what class name Qt might be registering for the window.

  3. #3
    Join Date
    Aug 2010
    Posts
    20
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: How to Know if our Qt application has focus from other No QT application

    Yes you are right, but I have too many windows to check, I imagine that I could set my own Class Name to the Qt application by setting any property to QApplication, but I cant find which one could be.

Similar Threads

  1. Replies: 0
    Last Post: 11th May 2010, 10:21
  2. Replies: 3
    Last Post: 6th January 2010, 16:55
  3. Making my Application sole focus !
    By fassage in forum Qt Programming
    Replies: 3
    Last Post: 11th November 2009, 10:13
  4. How detective lost focus application ?
    By Torsten in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2008, 14:19
  5. removing focus of application?
    By triperzonak in forum Qt Programming
    Replies: 0
    Last Post: 16th July 2008, 15:17

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.