Click to See Complete Forum and Search --> : events in controls
purusingh
Jun 24th, 2002, 10:25 AM
I made a dialog IDD_MY_DIALOG and associate procedure MY_DlgProc(....).
I have created a edit control IDC_EDIT1 and a button IDC_BUTTON1.
I can trap the clickevent of IDC_BUTTON in MY_DlgProc(....). as below
MY_DlgProc(....).
{
switch(msg)
{
case WM_CPMMAND:
switch(wParam)
{
case IDC_BUTTON1:
...........
}
}
}
Now How Can I trap the (EN_CHANGE) change event of IDC_EDIT1 in MY_DlgProc(....).
prog_tom
Jun 24th, 2002, 02:42 PM
all you have to do is
switch(msg)
{
case WM_COMMAND:
switch(LOWORD(wParam)){
case THEBUTTON:
switch(HIWORD(wParam)){
case EN_CHANGE:
//do stuff
break
}
break
}
break
}
hope that helps
purusingh
Jun 24th, 2002, 07:23 PM
Thank U very much.It would be very greatful if U tell me when to use loword and when to use hiword.
prog_tom
Jun 24th, 2002, 07:30 PM
Please don't thank me. I'm not all that good, afterall, I'm a 13 year old beginner. I still have to consult with other forum members on some questions, such Parksie and other guys.
Do you have AIM, or Yahoo Messenger?
abdul
Jun 24th, 2002, 09:09 PM
Originally posted by purusingh
Thank U very much.It would be very greatful if U tell me when to use loword and when to use hiword.
It's different for different messages. You can always consult MSDN for reference on a certain message. It'll tell you wether a message is stand-alone or it's sent through LPARAM or WPARAM parameters. It'll also tell you what type of information LOWORD and HIWORD of LPARAM and WPARAM have.
http://msdn.microsoft.com/library
prog_tom
Jun 25th, 2002, 09:42 AM
nice website you got there, abdul.
I see, it's still a layout?
http://www.hinst.net/~tom/sckoolboyhumor/
purusingh
Jun 26th, 2002, 09:38 AM
I got how to trap EV_CHANGE.Not I want to trap after finishing typing into edit box and pressing enter(validate event in vb).
CornedBee
Jul 10th, 2002, 05:52 PM
BTW prog_tom, your code is faulty.
It should be:
switch(msg)
{
// ...
case WM_COMMAND:
switch(LOWORD(wParam))
{
case THEBUTTON:
// handle button commands, only realistic are BN_CLICKED and
// BN_DBLCLCK, those are often handled together
break;
case THEEDIT:
// since an edit control may send many messages, we should
// do a switch on the actual command too
switch(HIWORD(wParam))
{
case EN_CHANGE:
// ...
break;
}
break;
}
break;
}
In WM_COMMAND, the arguments are used like this:
lParam = HWND of control
LOWORD(wParam) = ID of control
HIWORD(wParam) = actual command id
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.