PBDR.COM

About   -   Contact   -   Purchase   -   Search   -   What's New

 
 
Get Multiple File Open Types
This tip shows an undocumented features of the GetFileOpenName function. First of all you probably already know that you can list multiple items in the file type list as follows:
GetFileOpenName( 'title', ls_P, ls_F, 'bmp', &
        'Bitmaps (*.bmp),*.bmp,Icons (*.ico),*.ico' )

But the other day I was writing a new image viewer program which used an OCX to display different image formats and I wanted to allow the user to select a single image type or all images (not all files) so after a small play around I found out that you could do the following:

GetFileOpenName( 'title', ls_P, ls_F, '', &
        'Bitmaps (*.bmp),*.bmp,Icons (*.ico),*.ico' + &
        'All Images,*.bmp;*.ico' )

Which allows the user to select from a list of all image formats but not a file extension that is not in your list. It also means they do not have to drop the listbox of types down to select between different image types.

 

Top of Page

Legal Notice

Ken Howe 2011