file browser

Blitz3D Forums/Blitz3D Programming/file browser

Ben(t)(Posted 2008) [#1]
I know it can be done, but how can you make a search window for when i want to load a file into my program? like paint for instance, I press open and it pops up a little window that show all the files and folders in the current folder, how can i do that?


Kryzon(Posted 2008) [#2]
You'd need to use the GetOpenFileName and\or GetSaveFileName Windows API functions. It is very hard to do it for beginners, as you manually need to create a string-type buffer\bank so as to let the function write in the path of the file the user chose.
I myself had this question once and created a topic about it, here.

From that, I came up with three ways to use these API dialogs...
>> using this code archive entry (which is a bit of a nuisance since you need to download another .DECLS to use it, the code a bit hard to read, etc).
>> Using WinBlitz3D (an API wrapper for Blitz3D that has both save and open dialogs from windows).
>> Another good wrapper, BlitzSys. The good thing about BlitzSys is that you can cut all of the code you don't need and only let the small open\save file dialogs functions. You also don't need a userlib .DECLS as it uses native Blitz Basic CallDLL function to access the wrapper.
You can download BlitzSys 1.05 in this file deposit here: http://www.geocities.com/blitzmirror/, under the "Blitz3D Files" list.

G. Luck :D