Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Subclassing

Subclassing

Scheduled Pinned Locked Moved ATL / WTL / STL
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GeraldoLuiz
    wrote on last edited by
    #1

    I want to subclass some combobox controls on a dialog to handle WM_KEYDOWN msg (to delete contents using DEL key). 1. I`m using CContainedWindow. I use the function: OnKeyDown(TCHAR nChar, UINT nRepCnt, UINT nFlags) with MSG_WM_KEYDOWN in ALT_MSG_MAP(1). For one control, it's ok (works fine), but what if I want to subclass more than one and redirect all WM_KEYDOWN msgs to the same function ? How can I tell what control is receiving the message ? The m_hWnd member points to my dialog wnd. 2. I also tried the DDX way, using DDX_CONTROL and defining: class CCombo: public CWindowImpl and defining my controls of this class, but the compiler gives me an error saying that SubclassWindow is not a member of CComboBoxT How can I do it using #1 and what am I doing wrong with #2 ? Thanks.

    J 1 Reply Last reply
    0
    • G GeraldoLuiz

      I want to subclass some combobox controls on a dialog to handle WM_KEYDOWN msg (to delete contents using DEL key). 1. I`m using CContainedWindow. I use the function: OnKeyDown(TCHAR nChar, UINT nRepCnt, UINT nFlags) with MSG_WM_KEYDOWN in ALT_MSG_MAP(1). For one control, it's ok (works fine), but what if I want to subclass more than one and redirect all WM_KEYDOWN msgs to the same function ? How can I tell what control is receiving the message ? The m_hWnd member points to my dialog wnd. 2. I also tried the DDX way, using DDX_CONTROL and defining: class CCombo: public CWindowImpl and defining my controls of this class, but the compiler gives me an error saying that SubclassWindow is not a member of CComboBoxT How can I do it using #1 and what am I doing wrong with #2 ? Thanks.

      J Offline
      J Offline
      Jorgen Sigvardsson
      wrote on last edited by
      #2
      1. See CWindowImpl::GetCurrentMessage(). You'll find the recipient HWND in the MSG-struct, i.e. GetCurrentMessage()->hwnd. 2) That's because CComboBoxT doesn't derive from CWindowImpl which is the template which implements SubclassWindow. CComboBoxT is just a wrapper for an already existing window class, thus it isn't supposed to subclass another class. I never use DDX-stuff, so I wouldn't know how to deal with it. :shrug: -- Watcha' gonna do, when Hulkamania runs wild on you!?
      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups