News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Populating a TreeView with all the available Volumes and their folder structure

Started by K_F, May 13, 2019, 05:11:09 AM

Previous topic - Next topic

K_F

Just wondering if there a simple way of doing this. I've looked though all the docs and SDKs, and wonder if I've missed it.
With a combo box you have a single level file listing with the CB_DIR message.


Is there anything like this for a TreeView..
I'm nearly finished with a 'recursive' procedure to do this and although simple.. it is at first glance messy.
It uses the COM idea but is not COM.
?
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

fearless

The problem is the time to collect all the data and store in the treeview.


The best way i've seen is to handle the current folder and its enumeration of folders or files and for those folders that have child folders, to only populate when it is being expanded.


You can for example, create a dummy child entry so that it gets a + button on the node, then on expansion remove that dummy child and populate it with the folder's actual contents. Think of it as dynamically populating the treeview as required, rather than everything at once.

If its a small subset of folders, and is always going to be a small subset of folders, then perhaps its worth doing it all at once, recursing into each folder.

K_F

True..
I'm playing around with a block of memory from the heap, shifting 'object pointers' up and down with a simple ESI adjustment, and 'constant offsets' to access used structures.
Works pretty fast as the TreeView structure is there as you open the window... Good enough considering the slow speed of most RAD apps.

I'll post it when it's working well.
;)
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

Tedd

The trick is to only get the folder structure for the current level on-demand.

In your case, you'd build the top level with the volume names, and then you can add their first sub-level when/if they're expanded.

Convenient example attached.
Potato2

K_F

Finally got down to this...  :biggrin:
As a part-time side-line I'm busy with a little conversion program, so this is by no means complete or any attempt to clean it up.

The idea as mentioned in the original post was to populate the treeview with all volume details.
Naturally the on-demand method is better - I went through with this as proof-of-concept, so some stuff might look funny.

The process is to:-
- Load the treeview with Disk Volumes.
- Go through each Volume using a 'com' idea.

The Com data is Heap memory organised so one traverses up and down the heap as necessary.
This sample is taken from the orginal Assembler MDI example, and hacked a bit.
Click on the first toolbar button to start the action. Sit back and make a cup of tea.

On a rough count - watching the clocks second had
- Intel I7 laptop - Win10 with indexing on, standard user installation -> 45 seconds = 15,517 files processed per second.
- Intel Core I3 laptop - Win7, no indexing and minimal services -> 28 seconds = 17,032 files processed per second.  :skrewy:
:biggrin:
'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'