Jump to content

Get ListView items from "hidden" window


Recommended Posts

I'm writing a file submission utility, in which users run the program, add files to a ListView, then click submit. After submit is clicked, the Window containing the ListView will go away (since it's no longer needed), then a progress window will appear listing the progress and current file being uploaded.

However, I'm having a problem with _GUICtrlListViewGetItemText(). I'm using code similar to the following to loop through the list of files added to the ListView:

for $i = 0 to _GUICtrlListViewGetItemCount($upload) - 1
    msgbox(0,'',_GUICtrlListViewGetItemText($upload, $i, 0, $title, "This utility"))

This works perfectly fine, as long as the window is visible. However, as I said, I want to hide this window before proceeding with the upload. If I set GUISetState(@SW_HIDE) before running that loop, it will get the correct ItemCount, but it will not return the proper ItemText. Instead of filenames, it simply returns 1 for every item. I've tried both specifying the window text (as above) and leaving it blank, but no luck either way.

How can I work around this? I've done some experimenting, but I have not yet been able to find a way to read the ListView items from a "hidden" window. This seems like a bug in _GUICtrlListViewGetItemCount(), but of course it's possible that I'm not using it properly. Any ideas?


Edited by nitro322
Link to comment
Share on other sites

Thanks for the tip. I started investigating this command, and figured out how to get the information I need, but I'm still having a problem. For example:

msgbox(0, "GetItemCount1", ControlListView($title, "", $upload, "GetItemCount"))
msgbox(0, "GetItemCount2", ControlListView($title, "", $upload, "GetItemCount"))
progresson($title, "FTP upload progress", "Uploading ", -1, $height, 16)
msgbox(0, "GetItemCount3", ControlListView($title, "", $upload, "GetItemCount"))

In the above code, the the problem I had last time (with _GUICtrlListViewGetItemCount) occured when trying to read the ListView after the GUIDelete() line. So, only GetItemCount1. Using ControlListView, I'm now able to get both GetItemCount1 and GetItemCount2 to display properly; however, the command is still failing after I set enable the progress window. I'll still need someway to access this data after the progresson() function, as represented by GetItemCount3.

Do you have any other suggestions? I experimented again with diffirent combinations of title and text arguments for ControlListView(), but I couldn't get anything to work for GetItemCount3. Any other ideas would be greatly appreciated.


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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...