Click to See Complete Forum and Search --> : subclassing without resource?


merlinos
January 15th, 2007, 04:23 PM
Hi,

I need to customize the CEdit control to use character masks. I thought of subclassing but the CEdit controls I need to customize are on a view that is created from scratch, so there is no CEdit resource to attach to with a GetDlgItem. The existing CEdit controls are created with a call to Create().
How can I subclass without a resource?

Thanks,
Merlinos

alex_gusev
January 15th, 2007, 04:43 PM
well, that edit control has its ID anyway, so you CAN get it with GetDlgItem() if you know it or you may enumerate all children of your view and detect which ones are edit controls with GetClassName() call

once you get a pointer to CWnd, you can subclass it