PDA

View Full Version : c++ change edit box value with ID


nightthepope
03-15-2005, 09:44 PM
Ok, I'm programming in c++.
And my task is to change the value of an edit box to a different number.
I know the handle of the parent window. And I beleive I know the wID for the box also.

How would I be able to change the text in this box?

Dr. Evil
03-16-2005, 09:49 AM
Well, if you have the handle to it I think you can just use a SetDlgItemText() function call to change the text. Or perhaps a SetDlgItemInt().

aman
03-16-2005, 10:19 AM
Sounds like he should be looking into sending a WM_SETTEXT message via PostMessage()

nightthepope
03-16-2005, 01:49 PM
Would I be able to send a WM_SetText without the edit handle and just the ID and handle of the parent window?

Dr. Evil
03-16-2005, 02:32 PM
This should work:

SendDlgItemMessage([main window handle], [child ID], WM_SETTEXT, 0, (WPARAM)[string]);

nightthepope
03-17-2005, 01:04 AM
Thanks evil, is that (wparam)[string] part, would i just replace all that with my string? such as "string"

Dr. Evil
03-17-2005, 11:41 AM
No, that's a WPARAM cast. Replace the [string] part with your string, it should work. Another alternative would be to use the SetDlgItemText() function.

nightthepope
03-19-2005, 08:56 PM
I'm using

SendDlgItemMessage(FindWindow(NULL, strWindowTitle.c_str()), 742, WM_SETTEXT, 0, (WPARAM)"10");

but seem to get nothing.

any insight?