My progam, call it A.exe, starts another program, call it B.exe.
At a certain stage program A fills several edit controls with text strings.
(Belonging to program B, B.exe)
these are Name, Last-name, address, City.
(Using keybd_event or Sendinput, both work fine)
everything woks fine if the user does not interfear.
as soon as the user set the tab-caret on let say the address line, the text
string sending sequence is wrong, (name will be places in the address line, address in the
city line etc. and also the Next and Back button control get input, resulting in strange
I can find all the Control IDs using,
pWndx->GetDlgCtrlID(); (where x is between 1 and the amount of CtrlIDs)
I can even find and change the text of the buttons using
I can move the TAB-caret around using;
What I want is to set the TAB-caret at a certain place, Yes the name line.
If there is a test to check where the TAB-caret is that would be fine aswell.
So I can move it before sending the text strings.
So WM_NEXTDLGCTL is useless if you do not know where the caret is, I dont think
microsoft overlooked something, so where do I go wrong...
other options, how do I edit the edit-control class directly, using Spy++ I found out
there is a handle to the control, so it should be possible to put the text string in the
You can find out if your control has a keyboard focus by calling the GetFocus() API and compare it with the control's HWND handle. Your problem though is that you're trying to do this between two separate processes. I'm venturing to say that you're running your code on Windows XP or even earlier OS. The approach of using keybd_event() and SendInput() has been significantly redesigned in Windows Vista and Windows 7 that may make such incorrect interprocess communication obsolete. So my suggestion to you is to re-design your ways of doing this (i.e. put all your controls into the same process), or use other means of the IPC.
I'm working with studio 9.0 on a windows 7 OS.
putting the processes in one is not an option.
the getfocus and setfocus calls do not work on another process.
Also the setwindowtext() and setdlgitemtext() do not work on another proces.
(Funny thing, I can change the text from a control button "Next >", to for instance to" TEST".....)
Although Accessible Explorer (MFC Application) part of the SDK 2.0 gives me all the info.
Now the question how to access/change the data, of the edit-control.