Loading ...
Sorry, an error occurred while loading the content.

Re: getting contents of lists (GetListContents)

Expand Messages
  • Dennis K. Paulsen
    Hello, I m curious if your using Windows 9x or ME? If so, this issue exists and will need to be looked at. Note: Haven t had much time lately to work on this
    Message 1 of 9 , Aug 3, 2005
    • 0 Attachment
      Hello,
      I'm curious if your using Windows 9x or ME? If so, this issue
      exists and will need to be looked at. Note: Haven't had much time
      lately to work on this module.

      Regards,
      Dennis K. Paulsen

      --- In perlguitest@yahoogroups.com, "rafelafrance"
      <rafelafrance@y...> wrote:
      > I'm having the same problem. That is the GetListViewContents()
      > function is returning a list of empty stings. The only thing I
      have
      > to add is that it seems that HookProc() is never getting called.
      >
      > I ran a simple test where I change the *.xs module to put hard
      coded
      > values into the g_szBuffer string a points around the module. It
      > hits the GetLVItemText() function just fine but never the hook
      proc.
      > Hmmm... that may not be too clear. So here are the relevant
      changes...
      >
      >
      > At the top of the module I changed:
      >
      > //char g_szBuffer[MAX_DATA_BUF+1] =
      > {NUL};////////////////UNCOMMENT ME/////////////
      > char g_szBuffer[MAX_DATA_BUF+1]
      > = "Original";///////////DELETE ME////////////////
      >
      >
      >
      > And hook was changed like so...
      >
      > LRESULT HookProc (int code, WPARAM wParam, LPARAM lParam)
      > {
      > lstrcpy
      > (g_szBuffer, "Hook");////////////////////////DELETE ME////////
      > return CallNextHookEx(g_hHook, code, wParam,
      > lParam);///DELETE ME//
      > //// List Views ////
      > if (pCW->message == WM_LV_GETTEXT) {
      >
      >
      > When I run the program, I get back all "Original"s and no "Hook"s.
      > And hard coded string moves in GetLVItemText() overwrite the
      > string just fine.
      >
      > The odd thing is that when I use the the module on my computer at
      > home it works just fine. This stuff is all new to me so if you
      have
      > any ideas on how to proceed with the debugging or what may be
      wrong
      > that'd be great.
      >
      >
      > --- In perlguitest@yahoogroups.com, "duaneg40" <duaneg40@y...>
      wrote:
      > >
      > >
      > > I have installed the new release (it was great to see treeView
      > > support in there as well) and tried the new
      > > GetListViewContest function. It returns a list of
      > > two elements (perfect), but each element in the list
      > > seems to be a zero length string (seems wrong). Here is my
      example:
      > >
      > > my @windows = FindWindowLike(0,"- Notepad",0);
      > > my $wind_cnt = @windows;
      > > (@windows == 1) or die "Notebook not/multiple active
      > > (cnt=$wind_cnt)\n ";
      > > my $top_win = $windows[0];
      > >
      > > (Win32::GuiTest::SetForegroundWindow($top_win)) or die;
      > > SendKeys("%FO"); ## open up file menu
      > > sleep(1);
      > > my @wind2 = FindWindowLike(0,"Open","327"); ## "open" dialog
      at
      > > top-level
      > > (@wind2==1) or die "cnt=".@wind2."\n ";
      > > my @wind3 = FindWindowLike($wind2[0],0,"SysListView32");
      > > (@wind3==1) or die;
      > > my @list1 = Win32::GuiTest::GetListViewContents($wind3[0]);
      > > my $text1 = join(';',@list1);
      > > print "Test1='$text1' [".@list1."] [".length($list1[0])."]\n";
      > > exit(0);
      > >
      > > Any ideas? (I am running ActivePerl under win98). Thanks in
      > > advance for the help.
      > >
      > >
      > > --- In perlguitest@yahoogroups.com, "Dennis K. Paulsen"
      > > <ctrondlpaulsden@y...> wrote:
      > > >
      > > >
      > > > SysListView32 is a full-fledged 32bit control; which is
      affected
      > by
      > > > process boundary restrictions, so various SendMessage calls
      will
      > not
      > > > work as is... In the CVS build of Win32::GUITest exists a
      > > > GetListViewContents function; which you will want to use with
      > that
      > > > control. GetListContents will not work and SendMessage calls
      > will
      > > > not work as is, without additional work
      (injection,hooking)...
      > The
      > > > CVS (beta) build is at SourceForge.... I'll try and get a
      > release
      > > > together soon.
      > > >
      > > >
      > > > Regards,
      > > > D
      > > >
      > > > > Dennis,
      > > > > Thanks for the response.
      > > > > 1) The FindWindowLike() call I used returns a SysListView32
      > > > > window class (the regular expression is just a little shorter
      > > > > than the full name), so I seem to be using the correct
      window
      > > > class.
      > > > > 2) There doesn't seem to be a GetListViewContents in the 1.5-
      ad
      > > > > build (I am already using running under ActivePerl) ... The
      > > > > new DibSect class is awesome though ...
      > > > > bash-2.05$ grep GetListViewContents *
      > > > > bash-2.05$ grep GetListContents *
      > > > > changes: - Added GetComboText, GetComboContents,
      GetListText
      > > > and
      > > > > GetListContents
      > > > > guitest.pm: GetForegroundWindow GetListContents
      > GetListText
      > > > > GetMenu GetParent
      > > > > guitest.pm:=item @lst = GetListContents(hWnd)
      > > > > guitest.xs:GetListContents(hWnd)
      > > > > readme: @lst = GetListContents(hWnd)
      > > > > readme.html:<dt><strong><a name="item_getlistcontents">@lst
      =
      > > > > <code>GetListContents(hWnd)</code></a></strong><br />
      > > > > bash-2.05$
      > > > > 3) I looked at the Windows documentation:
      > > > > http://msdn.microsoft.com/library/default.asp?
      url=/library/en-
      > > > us/shell
      > > > > cc/platform/commctls/listboxes/aboutlistboxes.asp
      > > > > and the code in the release, and it all looks good to me. I
      > have
      > > > > a SendMessage() call in my example code to see if I can
      return
      > the
      > > > > correct list length, and that returns "0", so it makes so
      sense
      > > > that
      > > > > the list returned in empty. However, on the screen it seems
      > > > apparent
      > > > > that the list has two elements ... I am at a loss as what
      > > > > to try next ... Even the simple SendMessage() test case
      seems
      > > > > to fail ... There are no examples of SendMessage() in the
      > > > > release "eg/" directory ... It would be great to have just
      > > > > one small example as a test case.
      > > > >
      > > > >
      > > > >
      > > > > --- In perlguitest@yahoogroups.com, "Dennis K. Paulsen"
      > > > > <ctrondlpaulsden@y...> wrote:
      > > > > >
      > > > > >
      > > > > > The control you'd be working with should be a SysListView32
      > > > > control;
      > > > > > and GetListContents only works on list boxes... You'll
      want
      > to
      > > > use
      > > > > > the GetListViewContents function from the CVS build of
      Win32-
      > > > > > GuiTest; which is available at
      > > > > > http://sourceforge.net/projects/winguitest....
      > > > > >
      > > > > > P.S. To everyone: How is the CVS build working?
      > > > > >
      > > > > >
      > > > > > Regards,
      > > > > > D
      > > > > > --- In perlguitest@yahoogroups.com, "duaneg40"
      > <duaneg40@y...>
      > > > > wrote:
      > > > > > >
      > > > > > >
      > > > > > >
      > > > > > > Do anyone have an example of how to use
      GetListContents. I
      > > can
      > > > > > > not seem to get it to work. I have tried building a
      simple
      > > > > > > example based on Notepad, and that does not work either.
      > > > > > >
      > > > > > > Here is my example:
      > > > > > > use strict;
      > > > > > > use IO::File;
      > > > > > > autoflush STDOUT 1;
      > > > > > > use Win32::GuiTest qw(FindWindowLike SendKeys);
      > > > > > >
      > > > > > > if (1==1){
      > > > > > > my @windows = FindWindowLike(0,"- Notepad",0);
      > > > > > > my $wind_cnt = @windows;
      > > > > > > (@windows == 1) or die "Notebook not/multiple active
      > > > > > > (cnt=$wind_cnt)\n ";
      > > > > > > my $top_win = $windows[0];
      > > > > > >
      > > > > > > (Win32::GuiTest::SetForegroundWindow($top_win)) or
      die;
      > > > > > > SendKeys("%FO"); ## open up file menu
      > > > > > > sleep(1);
      > > > > > > my @wind2 = FindWindowLike(0,"Open","327");
      > > > > > > (@wind2==1) or die "cnt=".@wind2."\n ";
      > > > > > > my @wind3 = FindWindowLike($wind2[0],0,"SysList");
      > > > > > > (@wind3==1) or die;
      > > > > > > my $LB_GETCOUNT = 395;
      > > > > > > ## this returns Zero -->should be 2
      > > > > > > my $cnt = Win32::GuiTest::SendMessage($wind3
      > > > > > [0],$LB_GETCOUNT,0,0);
      > > > > > > my @list1 = Win32::GuiTest::GetListContents($wind3
      [0]);
      > > > > > > my $text1 = join(";",@list1);
      > > > > > > print "Test1='$text1' ".@list1." [$cnt]\n";
      > > > > > > exit(0);
      > > > > > > }
      > > > > > >
      > > > > > > The program prints: Test='' 0 [0]
      > > > > > > I would expect: Test='My eBooks;My Pictures' 2 2
      > > > > > >
      > > > > > > Any ideas??
      > > > > > > Thanks,
      > > > > > > Duane
    • rafelafrance
      ... Win XP SP2 in both cases. The differneces are: Home (It works) Module was compiled with VC6 & I m running ActiveState s Perl 5.8 At work (nothing in the
      Message 2 of 9 , Aug 3, 2005
      • 0 Attachment
        > I'm curious if your using Windows 9x or ME? If so, this issue
        > exists and will need to be looked at.

        Win XP SP2 in both cases. The differneces are:

        Home (It works)
        Module was compiled with VC6 & I'm running ActiveState's Perl 5.8

        At work (nothing in the strings)
        Compiled with VC7 & we're using the Perl 5.6 that comes packaged with
        Oracle.

        Random idea: Maybe there's a process permission issue? Things are
        locked down a bit more at work.

        > Note: Haven't had much time lately to work on this module.

        That's too bad. This is a really great module. Lightyears better than
        the expensive stuff we've been using. Anyway, I'll keep plugging away
        at it until it's solved or I'm forced to stop. If you have any hints
        I'll do my best to run them down.

        Thanks
        rafe

        --- In perlguitest@yahoogroups.com, "Dennis K. Paulsen"
        <ctrondlpaulsden@y...> wrote:
        > Hello,
        > I'm curious if your using Windows 9x or ME? If so, this issue
        > exists and will need to be looked at. Note: Haven't had much time
        > lately to work on this module.
        >
        > Regards,
        > Dennis K. Paulsen
        >
        > --- In perlguitest@yahoogroups.com, "rafelafrance"
        > <rafelafrance@y...> wrote:
        > > I'm having the same problem. That is the GetListViewContents()
        > > function is returning a list of empty stings. The only thing I
        > have
        > > to add is that it seems that HookProc() is never getting called.
        > >
        > > I ran a simple test where I change the *.xs module to put hard
        > coded
        > > values into the g_szBuffer string a points around the module. It
        > > hits the GetLVItemText() function just fine but never the hook
        > proc.
        > > Hmmm... that may not be too clear. So here are the relevant
        > changes...
        > >
        > >
        > > At the top of the module I changed:
        > >
        > > //char g_szBuffer[MAX_DATA_BUF+1] =
        > > {NUL};////////////////UNCOMMENT ME/////////////
        > > char g_szBuffer[MAX_DATA_BUF+1]
        > > = "Original";///////////DELETE ME////////////////
        > >
        > >
        > >
        > > And hook was changed like so...
        > >
        > > LRESULT HookProc (int code, WPARAM wParam, LPARAM lParam)
        > > {
        > > lstrcpy
        > > (g_szBuffer, "Hook");////////////////////////DELETE ME////////
        > > return CallNextHookEx(g_hHook, code, wParam,
        > > lParam);///DELETE ME//
        > > //// List Views ////
        > > if (pCW->message == WM_LV_GETTEXT) {
        > >
        > >
        > > When I run the program, I get back all "Original"s and no
        "Hook"s.
        > > And hard coded string moves in GetLVItemText() overwrite the
        > > string just fine.
        > >
        > > The odd thing is that when I use the the module on my computer at
        > > home it works just fine. This stuff is all new to me so if you
        > have
        > > any ideas on how to proceed with the debugging or what may be
        > wrong
        > > that'd be great.
        > >
        > >
        > > --- In perlguitest@yahoogroups.com, "duaneg40" <duaneg40@y...>
        > wrote:
        > > >
        > > >
        > > > I have installed the new release (it was great to see treeView
        > > > support in there as well) and tried the new
        > > > GetListViewContest function. It returns a list of
        > > > two elements (perfect), but each element in the list
        > > > seems to be a zero length string (seems wrong). Here is my
        > example:
        > > >
        > > > my @windows = FindWindowLike(0,"- Notepad",0);
        > > > my $wind_cnt = @windows;
        > > > (@windows == 1) or die "Notebook not/multiple active
        > > > (cnt=$wind_cnt)\n ";
        > > > my $top_win = $windows[0];
        > > >
        > > > (Win32::GuiTest::SetForegroundWindow($top_win)) or die;
        > > > SendKeys("%FO"); ## open up file menu
        > > > sleep(1);
        > > > my @wind2 = FindWindowLike(0,"Open","327"); ## "open"
        dialog
        > at
        > > > top-level
        > > > (@wind2==1) or die "cnt=".@wind2."\n ";
        > > > my @wind3 = FindWindowLike($wind2[0],0,"SysListView32");
        > > > (@wind3==1) or die;
        > > > my @list1 = Win32::GuiTest::GetListViewContents($wind3[0]);
        > > > my $text1 = join(';',@list1);
        > > > print "Test1='$text1' [".@list1."] [".len
        gth($list1[0])."]\n";
        > > > exit(0);
        > > >
        > > > Any ideas? (I am running ActivePerl under win98). Thanks in
        > > > advance for the help.
        > > >
        > > >
        > > > --- In perlguitest@yahoogroups.com, "Dennis K. Paulsen"
        > > > <ctrondlpaulsden@y...> wrote:
        > > > >
        > > > >
        > > > > SysListView32 is a full-fledged 32bit control; which is
        > affected
        > > by
        > > > > process boundary restrictions, so various SendMessage calls
        > will
        > > not
        > > > > work as is... In the CVS build of Win32::GUITest exists a
        > > > > GetListViewContents function; which you will want to use with
        > > that
        > > > > control. GetListContents will not work and SendMessage calls
        > > will
        > > > > not work as is, without additional work
        > (injection,hooking)...
        > > The
        > > > > CVS (beta) build is at SourceForge.... I'll try and get a
        > > release
        > > > > together soon.
        > > > >
        > > > >
        > > > > Regards,
        > > > > D
        > > > >
        > > > > > Dennis,
        > > > > > Thanks for the response.
        > > > > > 1) The FindWindowLike() call I used returns a SysListView32
        > > > > > window class (the regular expression is just a little
        shorter
        > > > > > than the full name), so I seem to be using the correct
        > window
        > > > > class.
        > > > > > 2) There doesn't seem to be a GetListViewContents in the
        1.5-
        > ad
        > > > > > build (I am already using running under ActivePerl) ... The
        > > > > > new DibSect class is awesome though ...
        > > > > > bash-2.05$ grep GetListViewContents *
        > > > > > bash-2.05$ grep GetListContents *
        > > > > > changes: - Added GetComboText, GetComboContents,
        > GetListText
        > > > > and
        > > > > > GetListContents
        > > > > > guitest.pm: GetForegroundWindow GetListContents
        > > GetListText
        > > > > > GetMenu GetParent
        > > > > > guitest.pm:=item @lst = GetListContents(hWnd)
        > > > > > guitest.xs:GetListContents(hWnd)
        > > > > > readme: @lst = GetListContents(hWnd)
        > > > > > readme.html:<dt><strong><a name="item_getlistcontents">@lst
        > =
        > > > > > <code>GetListContents(hWnd)</code></a></strong><br />
        > > > > > bash-2.05$
        > > > > > 3) I looked at the Windows documentation:
        > > > > > http://msdn.microsoft.com/library/default.asp?
        > url=/library/en-
        > > > > us/shell
        > > > > > cc/platform/commctls/listboxes/aboutlistboxes.asp
        > > > > > and the code in the release, and it all looks good to me.
        I
        > > have
        > > > > > a SendMessage() call in my example code to see if I can
        > return
        > > the
        > > > > > correct list length, and that returns "0", so it makes so
        > sense
        > > > > that
        > > > > > the list returned in empty. However, on the screen it seems
        > > > > apparent
        > > > > > that the list has two elements ... I am at a loss as what
        > > > > > to try next ... Even the simple SendMessage() test case
        > seems
        > > > > > to fail ... There are no examples of SendMessage() in the
        > > > > > release "eg/" directory ... It would be great to have just
        > > > > > one small example as a test case.
        > > > > >
        > > > > >
        > > > > >
        > > > > > --- In perlguitest@yahoogroups.com, "Dennis K. Paulsen"
        > > > > > <ctrondlpaulsden@y...> wrote:
        > > > > > >
        > > > > > >
        > > > > > > The control you'd be working with should be a
        SysListView32
        > > > > > control;
        > > > > > > and GetListContents only works on list boxes... You'll
        > want
        > > to
        > > > > use
        > > > > > > the GetListViewContents function from the CVS build of
        > Win32-
        > > > > > > GuiTest; which is available at
        > > > > > > http://sourceforge.net/projects/winguitest....
        > > > > > >
        > > > > > > P.S. To everyone: How is the CVS build working?
        > > > > > >
        > > > > > >
        > > > > > > Regards,
        > > > > > > D
        > > > > > > --- In perlguitest@yahoogroups.com, "duaneg40"
        > > <duaneg40@y...>
        > > > > > wrote:
        > > > > > > >
        > > > > > > >
        > > > > > > >
        > > > > > > > Do anyone have an example of how to use
        > GetListContents. I
        > > > can
        > > > > > > > not seem to get it to work. I have tried building a
        > simple
        > > > > > > > example based on Notepad, and that does not work either.
        > > > > > > >
        > > > > > > > Here is my example:
        > > > > > > > use strict;
        > > > > > > > use IO::File;
        > > > > > > > autoflush STDOUT 1;
        > > > > > > > use Win32::GuiTest qw(FindWindowLike SendKeys);
        > > > > > > >
        > > > > > > > if (1==1){
        > > > > > > > my @windows = FindWindowLike(0,"- Notepad",0);
        > > > > > > > my $wind_cnt = @windows;
        > > > > > > > (@windows == 1) or die "Notebook not/multiple
        active
        > > > > > > > (cnt=$wind_cnt)\n ";
        > > > > > > > my $top_win = $windows[0];
        > > > > > > >
        > > > > > > > (Win32::GuiTest::SetForegroundWindow($top_win)) or
        > die;
        > > > > > > > SendKeys("%FO"); ## open up file menu
        > > > > > > > sleep(1);
        > > > > > > > my @wind2 = FindWindowLike(0,"Open","327");
        > > > > > > > (@wind2==1) or die "cnt=".@wind2."\n ";
        > > > > > > > my @wind3 = FindWindowLike($wind2[0],0,"SysList");
        > > > > > > > (@wind3==1) or die;
        > > > > > > > my $LB_GETCOUNT = 395;
        > > > > > > > ## this returns Zero -->should be 2
        > > > > > > > my $cnt = Win32::GuiTest::SendMessage($wind3
        > > > > > > [0],$LB_GETCOUNT,0,0);
        > > > > > > > my @list1 = Win32::GuiTest::GetListContents($wind3
        > [0]);
        > > > > > > > my $text1 = join(";",@list1);
        > > > > > > > print "Test1='$text1' ".@list1." [$cnt]\n";
        > > > > > > > exit(0);
        > > > > > > > }
        > > > > > > >
        > > > > > > > The program prints: Test='' 0 [0]
        > > > > > > > I would expect: Test='My eBooks;My Pictures' 2 2
        > > > > > > >
        > > > > > > > Any ideas??
        > > > > > > > Thanks,
        > > > > > > > Duane
      • rafelafrance
        I don t know what the issue was (& I don t have the privs to find out) but once I got the System Manager to install ActiveState 5.8 at work everything is fine.
        Message 3 of 9 , Aug 11, 2005
        • 0 Attachment
          I don't know what the issue was (& I don't have the privs to find
          out) but once I got the System Manager to install ActiveState 5.8 at
          work everything is fine.

          --- In perlguitest@yahoogroups.com, "rafelafrance"
          <rafelafrance@y...> wrote:
          > > I'm curious if your using Windows 9x or ME? If so, this issue
          > > exists and will need to be looked at.
          >
          > Win XP SP2 in both cases. The differneces are:
          >
          > Home (It works)
          > Module was compiled with VC6 & I'm running ActiveState's Perl 5.8
          >
          > At work (nothing in the strings)
          > Compiled with VC7 & we're using the Perl 5.6 that comes packaged
          with
          > Oracle.
          >
          > Random idea: Maybe there's a process permission issue? Things are
          > locked down a bit more at work.
          >
          > > Note: Haven't had much time lately to work on this module.
          >
          > That's too bad. This is a really great module. Lightyears better
          than
          > the expensive stuff we've been using. Anyway, I'll keep plugging
          away
          > at it until it's solved or I'm forced to stop. If you have any hints
          > I'll do my best to run them down.
          >
          > Thanks
          > rafe
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.