adding text to another programs text box c++

Viewed 1944

i have already managed to send text to a custom text box i created using c++, and to notepad, calc and other programs all with 1 window and 1 text box. however, i want to send text to another program that has more than one text box and is in tabs too. it is structured like so:

  1. open program
  2. choose from a selection of 2 tabs: a. stats b. config(which contains the text boxes)
  3. fill in the 4 text boxes to desired values

i have tried winspy++ with no luck, here is simple code i have been working with.

#include <windows.h>

int main()
{ 
HWND hNote;
HWND hChild;

if (!(hNote=FindWindow("windowname",NULL)))
    exit(1);

if (!(hChild=FindWindowEx(hNote,NULL,"EDIT",NULL)))
    exit(2);

SendMessage(hChild,WM_SETTEXT,NULL,(LPARAM)"texttoadd");

return 0;
}

Can anyone help me how can resolve this issue ?

1 Answers
Related