Focus Messages?

This is a discussion on Focus Messages? within the Windows Programming forums, part of the Platform Specific Boards category; Ok, first off i'll start with my (shaky) understanding of window focus (which is probably very wrong): I have in ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92

    Focus Messages?

    Ok, first off i'll start with my (shaky) understanding of window focus (which is probably very wrong):

    I have in my mind the idea that other than windows which obviously give and take focus (ie. top level windows, mdi childs), that every sibbling window within a given parent can take *some* form of focus (keyboard input focus or something?) from its sibblings, right? Which would logically mean they would receive some kind of message when they receive or lose focus. I've been playing around with WM_ACTIVATE but it never seems to be sent to my windows, or other apps that I "spy" on (using Spy++).

    I'm now completely and utterly confused, so could anyone point me in the right direction... maybe an article to read or a message to pay attention to or *anything*??

    Thanks for your time,
    Jeff
    psychobrat at gmail

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,651
    Have you looked into WM_SETFOCUS and WM_KILLFOCUS?

    gg

  3. #3
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92
    Yup I have, but I don't seem to be receiving any (other than my top-level window and some sliders I had for testing in one of my windows). Is there some flag I should be setting when I create my window to allow it to grab the focus, or do I have to do this manually or something?

    Thanks,
    Jeff
    psychobrat at gmail

  4. #4
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92
    Not sure if I explained myself with the "or do this manually or something".

    Basically what I meant, is do I have to claim the focus somehow when a user clicks my window or something?

    Thanks

    -jEFF
    psychobrat at gmail

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,651
    Yes.
    Use SetFocus() to get the keyboard/input focus. It will send out the WM_KILLFOCUS and WM_SETFOCUS messages.

    gg

  6. #6
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92
    thanks mate :P
    psychobrat at gmail

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Spy++ view messages posted/sent to a control, or from it?
    By hanhao in forum Windows Programming
    Replies: 2
    Last Post: 06-24-2007, 11:07 PM
  2. Sending windows messages
    By Ideswa in forum Windows Programming
    Replies: 2
    Last Post: 03-02-2006, 12:27 PM
  3. Focus & Always-On-Top :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 06-13-2002, 05:44 PM
  4. Handles invalid when no focus?
    By Fordy in forum Windows Programming
    Replies: 6
    Last Post: 03-15-2002, 07:44 PM

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