Getting a change message

This is a discussion on Getting a change message within the Windows Programming forums, part of the Platform Specific Boards category; I'd like to do "instant calculating" (when user edits a Edit control, the program automaticly changes another Edit control). I ...

  1. #1
    Registered User
    Join Date
    Nov 2004
    Location
    Slovenia, Europe
    Posts
    115

    Getting a change message

    I'd like to do "instant calculating" (when user edits a Edit control, the program automaticly changes another Edit control). I know how to read and how to write in a Edit control, but I don't know which message carries an information about changing Edit fields?

    Thanks for help!
    [C++]
    IDE: DevC++ 4.9.9.2 (GCC 3.4.2)
    2nd compiler: g++ (GCC 3.4.3/4.0.0)
    3rd compiler: Borland 5.5
    [C#]
    IDE: Microsoft Visual C# Express 2005
    2nd IDE: SharpDevelop
    2nd compiler: csc in Command Prompt
    .NET Framework: 2.0
    [PHP]
    Core: 5.1.0 beta 3
    IDE: PHPEdit
    2nd IDE: Notepad
    Favourite extensions: exif,gd2,mysql
    Favourite PEAR packages: DB, XML_RSS, ID3
    Favourite databases: SQLite, MySQL

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    77
    To expand on anonytmouse's answer you will need something like this in your main window's callback function.
    Code:
    switch(message)
    {
        case (WM_COMMAND) :
        {
            if (LOWORD(wParam) == ID_OF_EDIT_CONTROL)
            {
                if (HIWORD(wParam) == EN_CHANGE)
                {
                     //Your edit control was just changed
                }
            }
            break;
        }
    }
    Any messages from a child windo to the parent in a WM_COMMAND message. wParam holds the ID of the control that sent the message in its low order bits. And the message that was sent in its high order bits. The macros LOWORD() and HIWORD() retrieve the low and high order bits from an integer. You can switch thise if statements into switch's if you intend to get additional child window messages.
    So, do you understand everything you know about this yet?

    "Begin at the beginning," the King said, very gravely, "and go on till you come to the end; then stop."

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    To be certain the notification was fired for a control, you'll want to ensure the lParam of the WM_COMMAND is non-NULL, too.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. socket message sending and receiving problem
    By black in forum C Programming
    Replies: 5
    Last Post: 01-15-2007, 04:46 AM
  2. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  3. Replies: 0
    Last Post: 10-23-2002, 09:45 AM
  4. Sending CChildView a Message :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 04-06-2002, 03:00 PM
  5. Replies: 2
    Last Post: 09-04-2001, 03:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21