Jump to content
Sign in to follow this  
wisem2540

Read info from proprietary listview?

Recommended Posts

wisem2540

Anyway...  I think its a listview.  Basically this is a screen with several columns that has a list of all the user accounts we have created for this app.

 

Eventually I want to be able to compare this data to a master list and filter out the ones we have already created.

So i thought I would try something simple just to see if I could target the window.  I tried this to get the selected count

#include <GuiListView.au3>

WinActivate ("Untitled - pcvusrmgr")
Sleep (2000)
$x = _GUICtrlListView_GetSelectedCount(1235)

MsgBox (0, "test", $x)

 

it comes back 0, when I am expecting 1

 

Here is the window info

>>>> Window <<<<
Title: Untitled - pcvusrmgr
Class: PcvUsrMgrApp_Class
Position: 176, 232
Size: 960, 700
Style: 0x1407C000
ExStyle: 0x00000100
Handle: 0x005E0EA0

>>>> Control <<<<
Class: SysListView32
Instance: 1
ClassnameNN: SysListView321
Name: 
Advanced (Class): [CLASS:SysListView32; INSTANCE:1]
ID: 1235
Text: 
Position: 2, 47
Size: 932, 182
ControlClick Coords: 421, 150
Style: 0x50200409
ExStyle: 0x00000000
Handle: 0x001B0E7E

>>>> Mouse <<<<
Position: 423, 197
Cursor ID: 0
Color: 0xE2E2FF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

 

 

Share this post


Link to post
Share on other sites
jdelaney

try this:

$hwnd = WinActivate ("Untitled - pcvusrmgr")
If Not IsHWnd($hwnd) Then
 ConsoleWrite("can't find window")
 Exit
EndIf
$hListView = ControlGetHandle($hwnd,"",1235)
If Not IsHWnd($hListView) Then
 ConsoleWrite("can't find listview")
 Exit
EndIf
Sleep (2000)
$x = _GUICtrlListView_GetSelectedCount($hListView)
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
wisem2540

that works fine.  I see you target it using the handle, rather than control ID.  Can you explain why this works, and my way does not?

Share this post


Link to post
Share on other sites
jdelaney

generally, when you use 'id' for the _guictrl* functions, it's implied that the id is from a control you create throught autoit (i think)...best to use handles whenever possible.

confirmed:

Func _GUICtrlListView_GetSelectedCount($hWnd)
    If $Debug_LV Then __UDF_ValidateClassName($hWnd, $__LISTVIEWCONSTANT_ClassName)

    If IsHWnd($hWnd) Then
        Return _SendMessage($hWnd, $LVM_GETSELECTEDCOUNT)
    Else
        Return GUICtrlSendMsg($hWnd, $LVM_GETSELECTEDCOUNT, 0, 0)
    EndIf
EndFunc   ;==>_GUICtrlListView_GetSelectedCount

look up guictrlsendmsg in helpfile...

controlID The control identifier (controlID) as returned by a GUICtrlCreate... function.

 

It would probably be best to elude to that in the _guictrl functions...like:

$hWnd Control ID (as retruned by a GuiCtrlCreate* function)/Handle to the control

 

I'm to lazy to put in the request :)

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
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
Sign in to follow this  

×