Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Automation Problem with Win32::GUI and Win32::GUITest

by talwyn (Monk)
on Mar 19, 2004 at 00:14 UTC ( [id://337850]=note: print w/replies, xml ) Need Help??


in reply to Automation Problem with Win32::GUI and Win32::GUITest

I have Further Investigated the problem and it seems the underlying problem is something in SendMessage from the API? I tried to write my own routine to retrieve the information I want. I get precisely the same results as with the WIN32::GUI Module, that is: Retrieving the item count works but attempting to retrieve the item text results in GPF in recieving App. Any Windows API C gurus out there that can point me in the right direction? Am I passing a bad parameter? I want to retrieve the displayed text of the first item of the first row in the first column. ( Not the headers )

Snippet requires Win32::API

sub ListView_GetItem ( $$ ) { # ( $wh_Handle, $RowIndex ) #constants use constant LVIF_TEXT => 0x01; use constant LVM_GETITEMCOUNT => 0x1004; use constant LVM_GETITEM => 0x1005; #LVM_FIRST +5 #types typedef Win32::API::Struct _LV_ITEM => qw( UINT mask; int iItem; int iSubItem; UINT state; UINT stateMask; LPTSTR pszText; int cchTextMax; int iImage; LPARAM lParam; ); #Vars my $handle = shift; my $index = 0; my %Item = {}; #Hash to hold Item info my $LV_Item = Win32::API::Struct->new ( '_LV_ITEM'); $Lv_Item->{mask} = LVIF_TEXT; $Lv_Item->{iItem} = 0; $Lv_Item->{iSubItem} = 1; #LRESULT SendMessage( # # HWND hWnd, // handle of destination window # UINT Msg, // message to send # WPARAM wParam, // first message parameter # LPARAM lParam // second message parameter # ); #LVM_GETITEM #wParam = 0; #lParam = (LPARAM) (LV_ITEM FAR*) pitem; Win32::API->Import( 'USER32', 'LRESULT SendMessage( HWND hWnd, UINT Msg, WPARAM wP +aram, LPARAM lParam)' ) || die "fAILED TO IMPORT sENDmESSAGE\n"; #works Fine $items = SendMessage ($handle,LVM_GETITEMCOUNT,0,0); print "Sendmessage saw $items items\n"; #Causes GPF in Recipient SendMessage ($handle,LVM_GETITEM,0,$Lv_Item) || die "Message Faile +d $!\n"; $text = chop $Lv_Item->{pszText}; print "The text is $text \n!"; return $text; }

Replies are listed 'Best First'.
Re^2: Automation Problem with Win32::GUI and Win32::GUITest
by Anonymous Monk on Apr 29, 2005 at 16:26 UTC
    You could try later versions of Win32::GUITest that includes better support for listviews. Try looking on www.cpan.org for the latest module.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://337850]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (None)
    As of 2024-04-25 00:00 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found