0

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.

  • Instead of replacing one hack with another, you should consider using the right tool: [UI Automation](http://msdn.microsoft.com/en-us/library/windows/desktop/ee684009.aspx). – IInspectable Dec 22 '13 at 18:17

1 Answers1

0

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.

ScottMcP-MVP
  • 10,337
  • 2
  • 15
  • 15