|
-
June 26th, 1999, 03:14 AM
#1
How use SubclassDlgItem() function?
I`m designing a dialog ,look like DOS dialog ,press RETURN ,DOWN ,UP
arrow ,jump to the next edit control.I don`t known how complete it.
Please help me.
-
June 26th, 1999, 09:45 AM
#2
Re: How use SubclassDlgItem() function?
I did not underdstand your question, but nevertheless use SubclassDlgItem like this:
1. First derive a class from the class of the control you want to subclass.
2. Override some functions to do whatever you want
3. Subclass the control in the InitDialog() like this:
SubclassDlgItem(IDC_CONTROL, this);
This will make the messages to be routed through your overrided functions.
But if you need just to catch some keys if they are pressed, better try this:
in the PreTranslateMessage() function of your dialog place similar code to the following:
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN && GetDlgItem(IDC_CONTROL) == GetFocus())
{
switch(pMsg->wParam)
{
case VK_ESCAPE:
case VK_RETURN:
case VK_HOME:
}
}
}
Hope this clears a little.
Regards,
ric
-
June 26th, 1999, 10:38 AM
#3
Thanks ric,your answer is very right for me.
It take me for four days to resolve this problem,
thank you again.
-
June 26th, 1999, 12:55 PM
#4
Re: Thanks ric,your answer is very right for me.
Alternatively, check out Examples 5 & 14 at my web site (http://home.earthlink.net/~railro/mfc_link.html) to know how to subclass a control.
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
[email protected]
http://home.earthlink.net/~railro/
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
|