|
-
June 5th, 2007, 09:59 AM
#1
Subclassing Using WTL
I'm trying to subclass an edit control using WTL. I am using this article for instruction
http://www.codeproject.com/wtl/subcl...ditcontrol.asp
So, basically, what I have, is a bunch of edit boxes that I create from a rc template, and my edit control subclass (in the article, this is CEditEnterAsTabT, in my code it's CEditArrowsT), and when I try to AttachToDlgItem (actually subclass the edit controls) in my dialogs OnInitDlg routine.
AttachToDlgItem
Code:
BOOL AttachToDlgItem(HWND parent, UINT dlgID)
{
m_dlgItem = dlgID;
m_parent = parent;
m_hWnd = ::GetDlgItem(parent, dlgID);
return SubclassWindow(m_hWnd);
}
In this method, SubclassWindow in the failiure. On MSDN it comments
Do not call SubclassWindow if you have already called Create.
But I don't call create, they're dialog elements programmed into the resource script. This comment is the only reason I can see for failure, is there anyway I might get around it? I might try hardcoding the edit controls into the dialog if there isn't but that seems very inconvenient.
Windows XP, Visual Studio 2008, SVN
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|