DJ143 Posted August 5, 2015 Posted August 5, 2015 Hi all,I am working on a window application and facing problem getting a list count. I've used the following functions, even though there are rows/list items present in WinList box every time it is returning 0 value. Please help on this.1. ControlListView ("Window Name", "", 123, GetItemCount)2. _GUICtrlListBox_GetCount(123)123 is the Control Id of the object(Win List) in "Window Name"
BrewManNH Posted August 5, 2015 Posted August 5, 2015 Listbox or Listview? You're mixing your control types. If you have a listview use _GUICtrlListView_GetItemCount. Also, make sure you're using the correct handle, because 123 doesn't look like a handle identifier. 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 GudeHow to ask questions the smart way! Reveal hidden contents 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
DJ143 Posted August 5, 2015 Author Posted August 5, 2015 hi,Here 123 is the control ID. I am not using the Handler here. Can you please explain more? Generally for getting a List count which is preferred and how can I get handle of an object in a window?
DJ143 Posted August 5, 2015 Author Posted August 5, 2015 hi,Here 123 is the control ID. I am not using the Handler here. Can you please explain more? Generally for getting a List count which is preferred and how can I get handle of an object in a window?
BrewManNH Posted August 5, 2015 Posted August 5, 2015 Use ControlGetHandle ( "title", "text", controlID ) to get the handle, the ListView UDF needs the handle, you're giving it the control ID. Check to make sure that ControlGetHandle returns a handle before trying to use the listview function, if you're not able to get the handle, you won't be able to get the count. Also, if you can't get the handle using it, then perhaps your control ID is incorrect. 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 GudeHow to ask questions the smart way! Reveal hidden contents 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
DJ143 Posted August 6, 2015 Author Posted August 6, 2015 Hi,I could able to get the handle of an object but still it is returning 0 number of list count. Following is the code i have triedWinActivate("XYZ Window")Local $hWnd= ControlGetHandle("XYZ Window", "",123) ;*123- is the control Id, got from AutoIt window Info->Control -> Id $iHcc= ControlListView ( "XYZ Window", "", $hWnd, "GetItemCount")MsgBox(0,"",$iHcc) ;* is returning 0Please check and let me know.
BrewManNH Posted August 6, 2015 Posted August 6, 2015 _GUICtrlListView_GetItemCount is the function that needs the handle to the control, ControlListView needs the control ID. Use _GUICtrlListView_GetItemCount with the handle and see if that works for you.Also, there's no way for me to check this, because I don't know what it is you're trying to access. 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 GudeHow to ask questions the smart way! Reveal hidden contents 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
marschall88 Posted January 27, 2020 Posted January 27, 2020 Hi, did you resolve this problem? I have same issue
Nine Posted January 27, 2020 Posted January 27, 2020 Do not resurrect old threads like that. I doubt very much that the guy is still around to answer you. Create a new thread and post the code you got (make it a snippet that we can actually run). To post your code, use this tool. “They did not know it was impossible, so they did it” ― Mark Twain Reveal hidden contents Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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