Thread: Edit control..win32..Changing the text?

  1. #1
    Unregistered
    Guest

    Angry Edit control..win32..Changing the text?

    How do u change the text of a edit box in a dialog? Not in the main window......... not using mfc... can anyone help me.. plz?

    SetDlgItemText() doesnt seem to work......

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    SetDlgItemText() does work.

    Need some code to find the problem.

    What params are you sending in?
    What callback are you in?
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Unregistered
    Guest
    the call itself...ive tried calling it from the main...from the callback WM_CREATE in ToolDlgProc.... im lost!ive tried calling it before and after i set the dialog up... in main

    SetDlgItemText(

    hwnd, // maybe this is wrong? its my handle for the main window which creates the dialog
    IDC_STATUS,
    "TEST");

    the dialog box which contains the edit control...

    DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(ID D_MAIN), hwnd, ToolDlgProc);

    finnaly its call back....

    BOOL CALLBACK ToolDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);



    Is there a certain value i need to set in the edit control to inable this to work..? Or does SetDlgItemText() have to be in a certain spot..? or do something special in a call back? im confused

  4. #4
    Unregistered
    Guest
    do i have to update the dialog or resource after i do this?

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    In ToolDlgProc()
    under WM_INIT or WM_CREATE

    SetDlgItemText(hWnd,IDC_STATIC,"Text to Set");
    UpdateWindow(hWnd);

    where hWnd is the HWND in the callback. eg of the whole dlg.

    or else where

    SetWindowText( GetDlgItem(hDlg, IDD_MAIN), IDC_STATIC, "Text to Set");
    UpdateWindow(GetDlgItem(hDlg, IDD_MAIN));
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Change cursor on single edit control
    By Niara in forum Windows Programming
    Replies: 3
    Last Post: 01-11-2009, 09:52 AM
  2. edit control text buffer
    By scurvydog in forum Windows Programming
    Replies: 4
    Last Post: 12-11-2008, 10:13 AM
  3. (Multiline) Edit Control Limit
    By P4R4N01D in forum Windows Programming
    Replies: 9
    Last Post: 05-17-2008, 11:56 AM
  4. Appending to an edit control
    By TheDan in forum Windows Programming
    Replies: 2
    Last Post: 03-31-2006, 12:27 PM