Wm_activate

This is a discussion on Wm_activate within the Windows Programming forums, part of the Platform Specific Boards category; Hi again, simple question, is there any other notification or another way to get the information that my window has ...

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    68

    Wm_activate

    Hi again,
    simple question, is there any other notification or another way to get the information that my window has lost focus or has regained focus or now is on top of the Z Order?

    I've only found WM_ACTIVATE, which sends a notification right before the window itself is going to gain/lose focus... so if I rightclick at the icon in on the taskbar I receive a WM_ACTIVATE -> WA_ACTIVE message. But I want to receive it only if the window really shows on top of the Z Order now (behind all topmost windows though). WM_SIZE is no solution.

    Thanks for help,
    Hawk

    Edit: Well I can somewhat solve my problem with showing and immediately hiding the child window if I click at the taskbar icon... but that's not a proper way.
    Last edited by Hawkin; 04-01-2007 at 10:55 AM.

  2. #2
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    You can try some of the notifcations listed in Window Notifications. Most notably, the WM_ACTIVATEAPP and WM_WINDOWPOSCHANGED notifications may be of interest to you.
    You can use GetTopWindow to get the handle of the window at the top of the Z-Order and check it against your own.

  3. #3
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    There's also GetFocus() that might help.

  4. #4
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    I actually came across that function, but I think its important to note its definition carefully before using it:
    The GetFocus function retrieves the handle to the window that has the keyboard focus, if the window is attached to the calling thread's message queue.
    Which is to say, I believe it is is only valid for child/owned windows of the calling thread.
    Edit: actually, nevermind, I see where you going with that, you can still check for a NULL return.
    Edit2: you may also want to use GetForeGroundWindow instead of GetTopWindow (difference being: top is topmost window, foreground is receiving user input)
    Last edited by @nthony; 04-01-2007 at 07:32 PM.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21