Child looses focus in a couple of seconds.

This is a discussion on Child looses focus in a couple of seconds. within the Windows Programming forums, part of the Platform Specific Boards category; I am using this code Code: DWORD WINAPI aeThread(LPVOID lpVoid) { HWND hwnd = CreateWindowEx(0, "AEdit", "In-program Editor", WS_VISIBLE | ...

  1. #1
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,624

    Child looses focus in a couple of seconds.

    I am using this code
    Code:
    DWORD WINAPI aeThread(LPVOID lpVoid)
    {
       HWND hwnd = CreateWindowEx(0, "AEdit", "In-program Editor",
                                  WS_VISIBLE | WS_CAPTION | WS_THICKFRAME,
                                  100, 100, 600, 370,
                                  HWND(lpVoid), NULL, GetModuleHandle(NULL), NULL);
       if(!hwnd) Quit(0, "Creation of AEdit window failed.");
       MSG aeMes;
       ZeroMemory(&aeMes, sizeof(MSG));
       while(GetMessage(&aeMes, NULL, 0, 0)) {
          TranslateMessage(&aeMes);
          DispatchMessage(&aeMes); }
       return 0;
    }
    to create a child window. Everything works fine, except for the fact that every time my child (or one of my child's children) gets focus, it looses it in a couple of seconds. Why is this?
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669
    Are you doing any processing on a timer?

    You can use Spy++ to capture messages - which can give you clues as to what is triggering any focus messages.

    gg

  3. #3
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,624
    No, no timer. If by Spy++ you mean WinSpy++, then I have no idea as how to catch messages.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  4. #4
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,624
    Oh, I see, you where refering to MS-Spy++. The only messages getting sent are WM_SETFOCUS and WM_KILLFOCUS, and their associated messages. Nothing fishy.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    What gets the focus after the WM_KILLFOCUS?

    eg what is taking the focus away from the child and can you stop it?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  6. #6
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,624
    The focus is given to the parent window.
    The parent recives WM_SETFOCUS at the same time the child recives WM_KILLFOCUS.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  2. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM
  3. Ensuring That Main Child Window Receives Focus
    By SMurf in forum Windows Programming
    Replies: 3
    Last Post: 08-28-2006, 05:32 AM
  4. Time to seconds program
    By Sure in forum C Programming
    Replies: 1
    Last Post: 06-13-2005, 08:08 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM

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