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; }

In reply to Re: Automation Problem with Win32::GUI and Win32::GUITest by talwyn
in thread Automation Problem with Win32::GUI and Win32::GUITest by talwyn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.