LxP Posted October 30, 2005 Share Posted October 30, 2005 (edited) Hi all,After searching the help file and the forums I couldn't find an easier way to do this -- ControlCommand()'s GetLineCount function appears only to work with Edit controls and most posts related to ListBoxes discuss ones found on AutoIt GUIs.Thanks to Valik for most of the actual work.Success: Returns the number of items.Failure: Returns -1 and sets @Error to 1 if the window/control couldn't be found or 2 if the DLLCall() failed.Func ListBoxGetCount($Title, $Text, $Control) Local Const $LB_GETCOUNT = 0x18B ; Assert that the window and control exist Local $Handle = ControlGetHandle($Title, $Text, $Control) If @Error Then SetError(1) Return -1 EndIf Local $Ret = DLLCall('User32.dll', 'Int', 'SendMessage', 'HWnd', $Handle, 'Int', $LB_GETCOUNT) If @Error Then SetError(2) Return -1 EndIf Return $Ret[0] EndFunc Edited October 30, 2005 by LxP Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now