Thank you. I used the second approach.
And to share that knowledge with other monks I attach the final code I used:
use Win32::API;
use Win32::guiTest qw( :ALL );
my ($repMainWindow) = FindWindowLike(undef, "Caption") or die $!;
Win32::API::->Import("user32","DWORD GetWindowThreadProcessId( HWND hW
+nd, LPDWORD lpdwProcessId)") or die $^E;
my $pidLPDWORDStruct = pack( "L", 0 );
GetWindowThreadProcessId($repMainWindow, $pidLPDWORDStruct);
my ($pid) = unpack ("L", $pidLPDWORDStruct);
Thanks for everyone who helped! |