Jump to content

no ListView with Win7 (32 or 64)


Recommended Posts

Hello, I hope someone would be able to assist with my problem.

I've been using a program for a while on Windows XP.

Now, we are switching to Windows 7 (32) and part of my scripts stopped working.

I found that anything related to _GUICtrlListView_ is giving me trouble.

The code to get the handle of the main window and the handle of the SysListView32 works.

The following examples are trying to find an "Issue Number" of a multicolumn ListView.

This example returns 0 (even when entering the handle manually and "Issue Number" exists).

$Line = _GUICtrlListView_FindText($list, "Issue Number")

This example returns blank (even when entering the handle and line manually).

$IssueNumber = _GUICtrlListView_GetItemText($list, $Line, 1)

Please let me know if any further information is needed.

I've tested this on x64 and 32 bit Win7.

Thanks!

Edited by cloudd901
Link to comment
Share on other sites

Is the text "Issue Number" in the first column of the ListView? What version of AutoIt are you using? Can you post a short reproducer script that shows the problem? As it is now, it's hard to reproduce it without reinventing your code with no idea how you wrote it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Sorry about that.

Autoit v3.3.8.0 (Win7) v3.3.6.0 (WinXP)

SciTE v2.28

Cisco Agent v8.0.2.200 (Program with ListView)

My scripts is actually about 2600 lines.

This is the trimmed version of the part of my script giving the issue.

This same script works fine in Windows XP (both 32bit).

Tested script compiled under both XP and 7 using 3.3.6.0 and 3.3.8.0.

-Verified that $Agent is correct. Verified $list is correct. $Line returns 0. $Queue returns blank.

#include <Array.au3>
#include <Constants.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>

$Agent = GetAgentHandle()
If Not @error Then
  ConsoleWrite(@CRLF & $Agent)
  $list = ControlGetHandle($Agent, "", "[CLASS:SysListView32; INSTANCE:2]")
  If Not @error Then
   ConsoleWrite(@CRLF & $list)
   $Line = _GUICtrlListView_FindText($list, "CSQName")
   $Queue = _GUICtrlListView_GetItemText($list, $Line, 1)
  Else
   TrayTip("Cisco Assistant", "Failed to Find ListView Handle.", 7, 17)
  EndIf
Else
  TrayTip("Cisco Assistant", "Failed to Find the Cisco Agent.", 7, 17)
EndIf
MsgBox(0,"",$Queue)

Func GetAgentHandle()
Local $Agent
$Agent = WinGetHandle("Reserved - Cisco Agent Desktop")
If @error Then
  $Agent = WinGetHandle("Talking - Cisco Agent Desktop")
  If @error Then
   $Agent = WinGetHandle("Work - Cisco Agent Desktop")
   If @error Then
    $Agent = WinGetHandle("Ready - Cisco Agent Desktop")
    If @error Then
     $Agent = WinGetHandle("Not Ready - Cisco Agent Desktop")
     If @error Then
      $Agent = WinGetHandle("Cisco Agent Desktop")
     EndIf
    EndIf
   EndIf
  EndIf
EndIf
If $Agent = "" Then SetError(1)
Return $Agent
EndFunc   ;==>GetAgentHandle

Posted Image

By cloudd901 at 2012-01-11

Please let me know if you have any thoughts or ideas. There has to be some difference between XP and Win7 when reading this ListView.

Edit:

I've had time to test some more tonight and still no luck.

I've tried changing "_GUICtrlListView_GetItemText" and "_GUICtrlListView_FindText" with "ControlListView".

Still the same results. Works on XP but not Win7.

Tried combinations of "Name or Handle" for the Window with "ClassnameNN or Handle or Advanced Info" for the Control.

Any other way of getting information from a ListView control?

Edit 2:

... I'm speachless ...

The ammount I worked on this just to find the simplest solution is crazy.

I went through every step of the _ListView_FindText() function and found the fault.

I found that I was getting an access error in the internal memory function __Mem_OpenProcess().

This could only mean one thing.......... UAC.

#RequireAdmin seems to be the best rout to ensure a working script. :)

Edited by cloudd901
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...