Results 1 to 8 of 8

Thread: events in controls

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Posts
    163

    events in controls

    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(....).
    Purushottam

  2. #2
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810
    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

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Posts
    163
    Thank U very much.It would be very greatful if U tell me when to use loword and when to use hiword.
    Purushottam

  4. #4
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810
    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?

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  5. #5
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    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
    Baaaaaaaaah

  6. #6
    Fanatic Member prog_tom's Avatar
    Join Date
    May 2001
    Location
    Los Angeles and Little Rock
    Posts
    810
    nice website you got there, abdul.
    I see, it's still a layout?
    http://www.hinst.net/~tom/sckoolboyhumor/

    prog_tom
    JOIN THE REVOLUTION!!!! Dual T3 backedup science community.
    http://physics.sviesoft.com/forum

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Posts
    163
    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).
    Purushottam

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    BTW prog_tom, your code is faulty.

    It should be:
    Code:
    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
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width