Subclassed Editbox Control: Do I need to create 2 classes for two edit boxes
-
Hi there. I am using Operating System: Windows XP Project: Visual Studio 2003 C++ MFC Dialog Based Application I subclassed an edit box control because I want to capture the WM_KEYDOWN messages when a user enters characters in the edit box. I need this because I want to measure the time interval between keystrokes for the phrase (a password in this case) that the user enters in the edit box. But I want the user to enter the password twice, once in one edit box and again in another. So I created two edit boxes and then to each edit box added a control variable of type the custom edit box subclass I created. Now the problem is that when a enter a character in either of the edit boxes, the OnKeyDown function of the subclass is called. How do I know in which edit box did the user type in the key? Should I rather create two subclasses for the edit boxes, and create a control variable for the one editbox that is of type: the one subclass, and to the other editbox I add a control variable that is of type: the other subclass?
-
Hi there. I am using Operating System: Windows XP Project: Visual Studio 2003 C++ MFC Dialog Based Application I subclassed an edit box control because I want to capture the WM_KEYDOWN messages when a user enters characters in the edit box. I need this because I want to measure the time interval between keystrokes for the phrase (a password in this case) that the user enters in the edit box. But I want the user to enter the password twice, once in one edit box and again in another. So I created two edit boxes and then to each edit box added a control variable of type the custom edit box subclass I created. Now the problem is that when a enter a character in either of the edit boxes, the OnKeyDown function of the subclass is called. How do I know in which edit box did the user type in the key? Should I rather create two subclasses for the edit boxes, and create a control variable for the one editbox that is of type: the one subclass, and to the other editbox I add a control variable that is of type: the other subclass?
Use
CWnd::GetDlgCtrlID()
.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown