I'm posting this again... since the last time I posted was in the middle
of the holidays and I got no response.  BTW, does anyone know where dada
is? His website has been down for a couple days now.

Garrett

[---Original post (slightly cleaned up) follows---]

Attached is a patch file which can be applied against the Win32GUI-BETA
build 220.  It contains the following new function wrappers:
SendMessageTimeout(), Maximize(), SetCapture(), ReleaseCapture(),
GetDlgItem(), GetCurrentProcess(), GetCurrentProcessId(),
GetCurrentThread(), GetCurrentThreadId(), AttachThreadInput(), and
GetWindowThreadProcessId(). I'm having a problem with the last.

If anyone remembers, I'm using the Win32::GUI to perform automated Win32
software testing. I'm  writing scripts to build a core set of tests that
manipulate software for a product that my company is developing. 

For the purpose of automated software testing, I want to be able to
AttachThreadInput from a separate process to my perl script so I can
GetFocus, SetFocus, spy on key states, etc. I've hit a wall in trying to
put GetWindowThreadProcessId into GUI.xs. Could anyone try my patch and
tell me why it doesn't work? The addition to GetWindowThreadProcessId()
in GUI.xs looks like:

DWORD
GetWindowThreadProcessId(handle, lpdword)
    HWND handle
    LPDWORD lpdword
CODE:
    RETVAL = GetWindowThreadProcessId(handle,lpdword);
OUTPUT:
    RETVAL


When I call this function in a script at say line 228 using a valid
$handle
from a dialog created by a separate process...

I do:
my $dlg_tpid = $gui->GetWindowThreadProcessId($handle,$whatever);

I get:
"Usage: Win32::GUI::GetWindowThreadProcessId(handle, lpdword) at
AutoTest.pm line 228"


or, when I do: 
my $dlg_tpid = $gui->GetWindowThreadProcessId($handle);

I get a return value of 0


or, when I do: 
my $dlg_tpid = GUI::GetWindowThreadProcessId($handle);

I err out with: 
"instruction referenced memory that can not be read..."


or ,when I do: 
my $dlg_tpid = GUI::GetWindowThreadProcessId($handle,$whatever);

I err out with: 
"instruction referenced memory that can not be read..."


any ideas?

Garrett
[EMAIL PROTECTED]
diff win32GUI-BETA/GUI.xs win32GUI-cgg/GUI.xs
750a751,758
>                   case BN_PUSHED:
>                       strcat((char *) Name, "_Pushed");
>                       PerlResult = DoEvent_Generic(Name);
>                       break;
>                   case BN_UNPUSHED:
>                       strcat((char *) Name, "_UnPushed");
>                       PerlResult = DoEvent_Generic(Name);
>                       break; 
2222a2231,2238
> Maximize(handle)
>     HWND handle
> CODE:
>     RETVAL = ShowWindow(handle, SW_SHOWMAXIMIZED);
> OUTPUT:
>     RETVAL
> 
> BOOL
2322a2339,2352
> SendMessageTimeout(handle,msg,wparam,lparam, fuFlags, uTimeout, lpdwResult)
>     HWND handle
>     UINT msg
>     WPARAM wparam
>     LPARAM lparam
>     UINT fuFlags
>     UINT uTimeout
>     LPDWORD lpdwResult
> CODE:
>     RETVAL = SendMessageTimeout(handle,msg,wparam,lparam, fuFlags, uTimeout, 
>lpdwResult);
> OUTPUT:
>     RETVAL
>     
> LRESULT
2750a2781,2795
> HWND
> SetCapture(handle)
>     HWND handle
> CODE:
>     RETVAL = SetCapture(handle);
> OUTPUT:
>     RETVAL
> 
> BOOL
> ReleaseCapture(...)
> CODE:
>     RETVAL = ReleaseCapture();
> OUTPUT:
>     RETVAL
> 
2792a2838,2891
> HWND
> GetDlgItem(handle,identifier)
>     HWND handle
>     int identifier
> CODE:
>     RETVAL = GetDlgItem(handle, identifier);
> OUTPUT:
>     RETVAL
> 
> HANDLE
> GetCurrentProcess(...)
> CODE:
>     RETVAL = GetCurrentProcess();
> OUTPUT:
>     RETVAL
> 
> DWORD
> GetCurrentProcessId(...)
> CODE:
>     RETVAL = GetCurrentProcessId();
> OUTPUT:
>     RETVAL
> 
> HANDLE
> GetCurrentThread(...)
> CODE:
>     RETVAL = GetCurrentThread();
> OUTPUT:
>     RETVAL
> 
> DWORD
> GetCurrentThreadId(...)
> CODE:
>     RETVAL = GetCurrentThreadId();
> OUTPUT:
>     RETVAL
> 
> DWORD
> GetWindowThreadProcessId(handle, lpdword)
>     HWND handle
>     LPDWORD lpdword
> CODE:
>     RETVAL = GetWindowThreadProcessId(handle,lpdword);
> OUTPUT:
>     RETVAL
> 
> BOOL
> AttachThreadInput(idAttach,idAttachTo)
>     DWORD idAttach
>     DWORD idAttachTo
> CODE:
>     RETVAL = AttachThreadInput(idAttach,idAttachTo,TRUE);
> OUTPUT:
>     RETVAL
diff win32GUI-BETA/TYPEMAP win32GUI-cgg/TYPEMAP
1a2
> HANDLE       T_IV
12a14
> LPDWORD      T_PV
Common subdirectories: win32GUI-BETA/docs and win32GUI-cgg/docs
Common subdirectories: win32GUI-BETA/samples and win32GUI-cgg/samples

Reply via email to