IonicWind Software

IWBasic => General Questions => Topic started by: Brian on April 02, 2024, 08:33:50 AM

Title: Folders and Files
Post by: Brian on April 02, 2024, 08:33:50 AM
Considering what I am doing with my GDI Picture Viewer, in that I am using an external DLL (pbsctrl.dll) to show drives, folders and files, does anyone have the code to do the same thing using Windows API?

There does seem to be some drawbacks in using this DLL, one being the loss of file icons (icon memory running out?), and it not always showing folders properly, ie, hanging up at times

Brian
Title: Re: Folders and Files
Post by: Egil on April 02, 2024, 10:24:13 AM
I don't have IWB on this laptop, but I think I have a similar snippet for IWB or EB at home.
But here is the code for CreativeBasic. Should be easy to convert to IWB


Good Luck!
Egil
Title: Re: Folders and Files
Post by: Brian on April 03, 2024, 07:01:02 AM
Good effort, Egil! But what I really want is for drives and folders to be in their own Treeview control. Anyway, here's your code converted to IWB, if anyone is interested

Brian
Title: Re: Folders and Files
Post by: Egil on April 03, 2024, 12:47:04 PM
Horst Schaeffer have written a smart little tool doing exactly that. I beleive it is written with PureBasic. The program is called "MemPad", and can be found on hiw webpage:
https://www.horstmuc.de/win.htm (https://www.horstmuc.de/win.htm)

If I was going to write such a tool, I would first call the FolderFind routine above, and then inspect the returned buffer line by line.
If the specific returned line is a file, write it to the first branch of a TreeView and if it is a folder put the returned buffer on hold and call the FolderFind routine again using a buffer with a second name and do the same with this new buffer until the end is reached, and then continue with the first buffer again.

In this way you will be able to fill in rather complex TreeViews. And I really beleive that the author of MemPad has done the coding in a similar way.

Should be interresting to try something like this, but that has to wait till I'm back home again ( in seven weeks). Or maybe you can try a day you become extra inspired??


Regards from Trondheim.

Egil
Title: Re: Folders and Files
Post by: Brian on April 04, 2024, 04:17:55 AM
Found some Powerbasic code to have a play with later
Brian
Title: Re: Folders and Files
Post by: ckoehn on April 06, 2024, 06:18:05 PM
There is this example in the IWBASIC Example folder.

Later,
Clint

Title: Re: Folders and Files
Post by: Brian on April 07, 2024, 05:26:45 AM
Yes, I have seen that, Clint, thanks. What I was hoping for is to get the results of the SHBrowseForFolder into a Treeview without actually showing the BrowseForFolder dialog

Brian