Jump to content

Getting number of items in ListView in external application.


Go to solution Solved by ModbusMan,

Recommended Posts

Posted (edited)

I am trying to automate the steps required by an compiler app. After loading and starting compilation the compiler opens a dialogue window with a ListView component in which the progress is logged. I need to know how many items are in the ViewList so I can detect when compilation is finished.

I've tried several things with no success:

Local $hCtrl = ControlGetHandle($hWnd, "", $sCtrlClass)

Local $aRetVal = _GUICtrlListView_GetItemCount($hCtrl)

$aRetVal = DllCall("user32.dll", "int", "SendMessage", "hwnd", $hCtrl, "int", $LVM_GETITEMCOUNT, "int", 0, "int", 0)

$aRetVal = _WinAPI_SendMessageTimeout ( $hCtrl, $LVM_GETITEMCOUNT , 0 , 0)

_GUICtrlListView_GetItemCount seems to be intented for use on ViewLists created when making an AutoIt GUI as far as I can see. Not sure for 100%.

In all 3 cases $aRetVal = 0.

Any help welcome here...

Spoiler

 

 

 

DBA compiler compile window.png

Edited by ModbusMan
Referred to ViewList component in post, should have been ListView.
Posted (edited)

Use AutoIt Window Info and hover this control to see exactly what kind of control is there. Make a screenshot and show us.

Edit: you can find the tool in your default AutoIt installation directory, it's called Au3Info.exe or Au3Info_x64.exe. Run the app and use the finder tool to get these info.

Edited by Andreik
  • ModbusMan changed the title to Getting number of items in ListView in external application.
  • Solution
Posted

Hi Andreik

Unfortunately I was using the wrong window title in ControlGetHandle to retrieve the ListView control handle. Got a valid control handle but not for the correct list box. 😦

_GUICtrlListView_GetItemCount, DllCall "user32.dll", _WinAPI_SendMessageTimeout as shown in the code in my previous post all work. So does the built-in AutoIt function ControlListView.

Thanks for the help. Problem solved.

Posted

That's why I said to use the AutoIt Info tool to double check the name of the window, classes, etc. To match window titles easier you can user AutoItSetOption() with option WinTitleMatchMode.

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
×
×
  • Create New...