I'm automating a software using SendKeys.
The s/w is executed in my Delphi 7 code by CreateProcess.
The first time I want to sendkeys, I get the window handle by a title search.
Then I use than handle subsequently.
Everything works like it should but sometimes, typically when sending keystrokes to close a window that has been open for a while, it fails.
Most of the time, everything works flawlessly without incident while my Delphi program runs for days if not weeks - yes, execution time is very long. But other times, I could get this problem every hour during an execution.
Should I run my HandleByTitle every time I want to send a keystroke? And if YES, won't there always be the possibility that the handle could change in the very short interval between getting the handle and then using it ASAP?
Thanks in advance,
Tom
The s/w is executed in my Delphi 7 code by CreateProcess.
The first time I want to sendkeys, I get the window handle by a title search.
Then I use than handle subsequently.
Everything works like it should but sometimes, typically when sending keystrokes to close a window that has been open for a while, it fails.
Most of the time, everything works flawlessly without incident while my Delphi program runs for days if not weeks - yes, execution time is very long. But other times, I could get this problem every hour during an execution.
NOTE: I have not demonstrated this, but I suspect that this problem occurs when the PC has been on for a long time. After a fresh boot, I suspect this problem does not surface.
Should I run my HandleByTitle every time I want to send a keystroke? And if YES, won't there always be the possibility that the handle could change in the very short interval between getting the handle and then using it ASAP?
Thanks in advance,
Tom