I'm trying to develop a Perl script that controls an application in a very simple manner(fills some boxes, presses some keys). I've implemented everything using Win32::GuiTest. The goal is to make it work with the app being minimized in tray, allowing me to use the PC at the same time.
I'm using functions like: WMSetText , SelComboItem , SendMessage, PushChildButton.
All of them work fine, except for PushChildButton. Whenever this function is called, I'm losing focus(even though the controlled app stays minimized) from whatever I'm doing.
Application that I'm using before calling PushChildButton: http: // i. imgur.com/7B5kj.png
Application that I'm using after calling PushChildButton: http: // i. imgur.com/VCskW.png
I've tried killing the focus like this, but it did not work:
my $msg_id=0x08;
SendMessage( @_[ 0 ], $msg_id, @_[ 1 ], undef );
@_[ 0 ] - handle to the application
@_[ 1 ] -handle to the "Edit Control" that I think* that takes the focus after pressing the button
*Let me elaborate this a bit. The application still stays minimized, but sometimes that "Edit Control" resource contains strings that are concatenated with the keys that I've pressed while losing the focus.
PS: I'm a beginner with Perl and WinAPI(in fact this is my first project), so I might have explained things a bit unclear. Please ask me everything that you feel that I should elabo开发者_运维问答rate.
Most likely this is a windows problem, not perl. People do this normally with a normal window moved outside the visible desktop range, e.g. to the left, x=-600.
Use Win32::GUI instead. This will save you many more headaches.
精彩评论