Child with its own Registered Class

This is a discussion on Child with its own Registered Class within the C++ Programming forums, part of the General Programming Boards category; I'm creating 2 classes with RegisterClassEx, one for the parent and one for a child. Each class has its own ...

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    93

    Child with its own Registered Class

    I'm creating 2 classes with RegisterClassEx, one for the parent and one for a child.
    Each class has its own window procedure that handles its own messages.
    The child is receiving 95% of its messages, but not WM_MOUSEWHEEL and WM_KEYDOWN/UP.
    The parent gets them, of course, but I want the child to get them whenever the mouse is over the child.
    The first thing that came to mind was subclassing the child, but how when it has a class of its own?
    Or would that even be right since the child gets WM_LBUTTONDOWN/UP, WM_LBUTTONDBLCLK, and WM_MOUSEMOVE.
    What am I missing?
    Thanks.

  2. #2
    Registered Boozer
    Join Date
    Jan 2008
    Location
    Canada
    Posts
    1,739
    Try this in the parent's windowproc:
    Code:
    	case WM_SETFOCUS:
    		SetFocus(g_hwndChild);
    		return 0;
    You may also have to do an initial SetFocus call after creating and displaying the windows.

    BTW, this question actually belongs in the Windows forum.

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    93
    Thanks, I'm now doing SetFocus(hChild) in the child WM_LBUTTONDOWN and it works perfect.
    (sorry about the wrong forum)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Cast a parent class to child
    By snowcore in forum C# Programming
    Replies: 12
    Last Post: 03-04-2011, 09:02 AM
  2. Classes, pointer to itself to access from a child class
    By lautarox in forum C++ Programming
    Replies: 7
    Last Post: 09-23-2010, 12:43 PM
  3. Replies: 3
    Last Post: 04-10-2009, 02:20 AM
  4. gcc: Template class child can't directly access parent fields
    By SevenThunders in forum C++ Programming
    Replies: 11
    Last Post: 03-17-2009, 06:05 AM
  5. A little question on template parent/child class...
    By JamesW in forum C++ Programming
    Replies: 1
    Last Post: 05-08-2003, 06:39 PM

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