Thread: Another Edit question

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    215

    Another Edit question

    What im trying to do is when the user changes something in an edit box i want the edit box to be be set to something so i was just trying to test this thing out but when i do it, my program just goes away. Here's the code

    Code:
    case ID_MAG_MIN:	
    	
    SendMessage(GetDlgItem(hwnd,ID_MAG_MIN),WM_SETTEXT,0,"34.0");
    
    break;

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>when the user changes something in an edit box<<

    Handle the EN_CHANGE notification (as HIWORD(wParam) of the parent's WM_COMMAND).
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    215
    do u have an example of how to do it. i tried this, but it didnt work...

    Code:
    case EN_CHANGE:
    			switch(HIWORD(wParam))
    			{
    			case ID_MAG_MIN:
    				SendMessage(GetDlgItem(hwnd,ID_MAG_MIN),WM_SETTEXT,0,"34.0");
    				break;
    
    
    
    			}

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    EN_CHANGE is delivered in a WM_COMMAND message. Ken has posted code before demonstrating how to handle WM_COMMAND messages:

    http://cboard.cprogramming.com/showt...ght=WM_COMMAND

  5. #5
    Registered User
    Join Date
    May 2004
    Posts
    215
    I dont understand how to code EN_CHANGE as a HIWORD param, i mean i was thinkin

    EN_CHANGE=HIWORD(param), but i got an error doing that

  6. #6
    Registered User
    Join Date
    May 2004
    Posts
    215
    i figured it out, so thanks everyone!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Menu like file, edit, help, etc...
    By Livijn in forum Windows Programming
    Replies: 44
    Last Post: 01-23-2007, 05:49 PM
  2. need to edit text from within my application.
    By spiroth10 in forum C++ Programming
    Replies: 2
    Last Post: 12-15-2006, 03:15 PM
  3. Adding buttons, edit boxes, etc to the window
    By rainmanddw in forum Windows Programming
    Replies: 1
    Last Post: 04-10-2006, 03:07 PM
  4. newbie to rich edit, cant get it to work
    By hanhao in forum Windows Programming
    Replies: 1
    Last Post: 03-24-2004, 10:54 PM
  5. Difficulty superclassing EDIT window class
    By cDir in forum Windows Programming
    Replies: 7
    Last Post: 02-21-2002, 05:06 PM