Results 1 to 19 of 19

Thread: How to send message to Desktop Widget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: How to send message to Desktop Widget


  2. #2
    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 send message to Desktop Widget

    QPixmap::grabWindow() takes a native window system identifier (WId).
    J-P Nurmi

  3. #3
    Join Date
    Jan 2007
    Posts
    20
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: How to send message to Desktop Widget

    Hi,
    Thnx Marcel and Jpn for your valuable suggestions.
    But the thing is that i want use this capture screen technology on MAC, Linux, and Windows.
    So i thought that QT have some support for it but i haven't found anything useful yet.

    "Jpn" although grabWindow() can work for me but the whole thing is that how can i know in my QT app that which is active window and how do i get winId of the active window.

    And "Marcel" the link you had given me is a useful one i want to use my app across many platforms including MAC, Linux and Windows.



    Thnx again for your kind help.

  4. #4
    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 send message to Desktop Widget

    Quote Originally Posted by shyam prasad View Post
    "Jpn" although grabWindow() can work for me but the whole thing is that how can i know in my QT app that which is active window and how do i get winId of the active window.
    I'm afraid you need a platform dependent solution for that.

    Something like XGetInputFocus(), GetActiveWindow() and so on..
    J-P Nurmi

  5. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to send message to Desktop Widget

    Did u happen to see the Screen capture example in the Qt demos ?? U can find it under Desktop->Screen capture in the demo....

    it uses something like...
    originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
    am not sure how portable is this.

    hope this helps...
    Last edited by aamer4yu; 18th April 2007 at 06:21.

  6. #6
    Join Date
    Jan 2007
    Posts
    20
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: How to send message to Desktop Widget

    Hi,
    Thanks to all for your valuable suggestions.
    I know that how it can be done using Windows APIs.
    But i haven't done anything in MAC or Linux.
    So i don't know how to implement function which can capture active window.
    I am not aware of MAC and Linux specific APIs.
    And also i don't have any link or documentation like MSDN for Mac and Linux systems.

    If anybody have any idea how can i write this function for Mac and Linux then please help me out.

    In Window GetWindowFromPoint() gives me the handle of window which i clicked using mouse. and then everything is easy. But i don't know how i can do this using MAC and Linux specific APIs.

    Also in my first post i asked whom i should sent this "Alt + PrtScn" message so that it will just dump the Active Window image to the clipboard. I think if i can do this then it will ease my work.

    Or can anyone show me the code snippet to capture active window on Mac and Linux, especially Mac OS.

    Waiting for valuable suggestions from all of you. Thanks for your interest. I think there are many people who wants to do the same thing.

    Thanks in advance.
    Shalabh............

  7. #7
    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: How to send message to Desktop Widget

    And also i don't have any link or documentation like MSDN for Mac and Linux systems.
    For mac: developer.apple.com
    For linux: the X server api documentation www.x.org

    regards

  8. #8
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to send message to Desktop Widget

    from Qt docs...
    WId QWidget::winId () const
    Returns the window system identifier of the widget.
    Portable in principle, but if you use it you are probably about to do something non-portable. Be careful.
    what does it mean by portable in principle ??
    is this function portable or non portable ??

  9. #9
    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: How to send message to Desktop Widget

    It is portable! But in principle

  10. #10
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to send message to Desktop Widget

    OK...
    so in principle.. its portable !!

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to send message to Desktop Widget

    It means that it is portable by itself, but if you use it, you are doing something which is not portable, so portability of the winId() method is not important as it is surrounded by an unportable code.

  12. #12
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to send message to Desktop Widget

    hmm... understood somewhat,,,
    tell me one thing more...
    will the code of screnshot example of the Qt demo run on Windows, Linux, and Mac ?? i may understand better by this answer

Similar Threads

  1. Controlling which widget on top layer?
    By JonathanForQT4 in forum Qt Programming
    Replies: 6
    Last Post: 22nd March 2007, 14:27
  2. Replies: 4
    Last Post: 10th March 2007, 18:01
  3. Pin/Unpin Dock Widget
    By charlesD in forum Newbie
    Replies: 1
    Last Post: 21st June 2006, 06:57
  4. Replies: 4
    Last Post: 24th March 2006, 22:50
  5. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 14:16

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.