Sign in to follow this  
Followers 0
nitro322

Get ListView items from "hidden" window

5 posts in this topic

#1 ·  Posted (edited)

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"))
next

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?

Thanks.

Edited by nitro322

Share this post


Link to post
Share on other sites



If your going to be working with hidden windows, I suggest looking into the ControlListView function in the help

Gary


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
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"))
GUIDelete()
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.

Thanks.

Share this post


Link to post
Share on other sites

Might want to change the title of your progresson window to something different that your window your attempting to get the data from.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

D'oh! That was exactly my problem. I didn't even think of it.

Everything's working great now. Thanks!

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  
Followers 0