SetDlgItemText issue

Hello,

I need help with the following:

I have made a MFC dialog based application.
On click of a button I am calling a function (Clear)which calls the following

SetDlgItemText (hwnd, EF_JOB, "");

This function (Clear)is defined in seperate cpp file. the header file of which i am including in the dlg.cpp file

The problem is that the above function just doesnt seem to work

Can anyone please help

Thanks
Taher

Comments

  • : Hello,
    :
    : I need help with the following:
    :
    : I have made a MFC dialog based application.
    : On click of a button I am calling a function (Clear)which calls the following
    :
    : SetDlgItemText (hwnd, EF_JOB, "");
    :
    : This function (Clear)is defined in seperate cpp file. the header file of which i am including in the dlg.cpp file
    :
    : The problem is that the above function just doesnt seem to work
    :
    : Can anyone please help
    :
    : Thanks
    : Taher
    :
    [blue]You should check if window identified by [b]hwnd[/b] has a control with ID=[b]EF_JOB[/b]. You can do it with:

    HWND hControl = ::GetDlgItem (hwnd, EF_JOB);

    put it just before your [b]SetDlgItemText()[/b] and check the [b]hControl[/b]. If its value is zero - then check your resources or where [b]hwnd[/b] is coming from.[/blue]
  • : Hello,
    :
    : I need help with the following:
    :
    : I have made a MFC dialog based application.
    : On click of a button I am calling a function (Clear)which calls the following
    :
    : SetDlgItemText (hwnd, EF_JOB, "");
    :
    : This function (Clear)is defined in seperate cpp file. the header file of which i am including in the dlg.cpp file
    :
    : The problem is that the above function just doesnt seem to work
    :
    : Can anyone please help
    :
    : Thanks
    : Taher
    :

    I guess u already call UpdateWindow() for your Dialog, do you?

  • [b][red]This message was edited by AsmGuru62 at 2002-10-31 8:9:50[/red][/b][hr]
    : : Hello,
    : :
    : : I need help with the following:
    : :
    : : I have made a MFC dialog based application.
    : : On click of a button I am calling a function (Clear)which calls the following
    : :
    : : SetDlgItemText (hwnd, EF_JOB, "");
    : :
    : : This function (Clear)is defined in seperate cpp file. the header file of which i am including in the dlg.cpp file
    : :
    : : The problem is that the above function just doesnt seem to work
    : :
    : : Can anyone please help
    : :
    : : Thanks
    : : Taher
    : :
    :
    : I guess u already call UpdateWindow() for your Dialog, do you?
    :
    :
    [blue][b]SetDlgItemText()[/b] usually invalidates the control by itself. You need [b]UpdateWindow()[/b] if you use it in a loop without getting back to Windows.[/blue]


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories