how would I change a window handles via edit control box in an mfc application?

271 views Asked by At

I have made a small program (using mfc) that edits a text box in another one of my applications, but every time I want to use my program I have to edit the following:

HWND editbox = (HWND)0x0000000;

to whatever the new handle is using winspy++, I would like to know how I would go about adding another text box with a button so I can add in the new value, click the button, and it is updated so I no longer have to keep rebuilding my application with the new handle.

1

There are 1 answers

0
ScottMcP-MVP On

You can read the contents of an edit control using

GetDlgItemText(hDlg, ID_THE_EDIT_CONTROL, buffer, buffersize);

Then convert the string in buffer to an unsigned int for use as the HWND.