No announcement yet.

SubClassing a Child control "in a Control"

  • Filter
  • Time
  • Show
Clear All
new posts

  • SubClassing a Child control "in a Control"


    I have a Tab control that is subclassed. On the upper right corner
    of this control is an Up-Down(spin control) This UpDown control sends
    the Tab several messages like WM_SETFOCUS,WM_HSCROLL,WM_PAINT.

    The message that I want from the Up-Down control is only available
    if I subClass it aswell. So how do you subclass a child(UpDown) control
    in a (Tab) control? (How to get its hWnd handle?)

    Note: I also have subclassed this Tab control to trap several needed messages.

    Thanks for any help or suggestions.

    Regards, Jules [email protected]


  • #2

    I think you have to enumerate the child windows of the tab control
    to see if you get anything back from it. If its the only control
    on the tab control, it should be easy enough but if there are a
    number of different types, you may have to differentiate on the basis
    of the class name of each enumerated window.

    Good Luck.

    [email protected]

    hutch at movsd dot com
    The MASM Forum - SLL Modules and PB Libraries


    • #3
      You could use EnumChildWindows as Hutch suggested but because of the small
      number of windows involved a direct approach is better.

      hWndUpDown = GetWindow(hWndTab, %GW_CHILD)

      The above is fine for a tab control because it has only one child control.

      The following using the combo box as an example demonstrates a more general
      approach. The combo box(CBS_DROPDOWN, CBS_SIMPLE) has two child controls,
      an edit box and a list box. To get the handle of the list box do the following.

      hWndList = GetWindow(hWndCombo, %GW_CHILD)
      GetClassName hWndList, szClassName, 255
      IF UCASE$(szClassName) <> "COMBOLBOX" THEN hWndList = GetWindow(hWndList, %GW_HWNDNEXT)

      Dominic Mitchell

      [This message has been edited by Dominic Mitchell (edited September 03, 2000).]
      Dominic Mitchell
      Phoenix Visual Designer


      • #4
        Thank you Gentlemen!

        It should of hit me if I had of thought of the ComboBox Idea. I have
        several snippets to subclass the children of ComboBoxes.

        Thanks again for your time and help!

        Regards, Jules