activate the window
An improper command error stops at the 'w.activate' line when using the following code:
p := Sys.WaitProcess(lAppName,10000);
w := p.WaitWindow(lWinClass, lWinCaption, -1, 10000);
w.DataField.Text := lFieldInput;
I have tried to increase timout period at line 2 or even used the code below but it still fails.
w := p.WaitWindow(lWinClass, lWinCaption, -1, 40000);
But if I set a break point at the 2nd line code (w := p.WaitWindow(lWinClass, lWinCaption, -1, 40000), it passes throught the line 3 (w.activate).
Unfortunately, if I remove the break point and re-run the code, the improper command is shown again.
How can I sort this out?
Re: activate the window
It looks like the window exists, but is not ready yet. So, it doesn't respond to messages sent by TC. I suggest that you try adding a delay before calling the Activate method (a couple of seconds should be enough for debugging purposes) to check this.