Thread: Child with its own Registered Class

  1. #1
    Registered User
    Join Date
    Feb 2010

    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?

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Try this in the parent's windowproc:
    	case WM_SETFOCUS:
    		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.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  3. #3
    Registered User
    Join Date
    Feb 2010
    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, 10: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