Re: HOW? OpenFileDialog Multiselect by 100
100
Fri Jan 09 10:06:27 CST 2004
Hi Lee Gillie,
AFAIK there is no easy way to do that. I'm not sure if this can be done at
all with the FileOpenDialog class.
What you can do is to use PInvoke and call GetOpenFileName API function.
That function accepts one scary structure (OPENFILENAME) as a parametter.
To initialize the open file dialog with more then one file you can set its
*lpstrFile* field with string of the form
"<file path>\0<file name 1>\0<file name 2>\0.......\0<file name N>\0"
My next idea (I've never tried it) is the following.
Open and Save As dialog boxes provide so called OFNHookProc. The dialog box
calls the hook sending it some messages and notifications. Along with the
WM_INITDIALOG message the dialog sends that OPENFILENAME structure. I'm not
sure but you may be able to change the *lpstrFile* field at that stage of
the dialog creation. I'm telling you that because OpenFileDialogClass gives
us te opportunity to install that hook by inheriting the OpenFileDialog
class and overriding *HookProc* virtual method.
For more info about OFNHookProc check with MSDN
ms-help://MS.MSDNQTR.2003FEB.1033/winui/winui/windowsuserinterface/userinput
/commondialogboxlibrary/commondialogboxreference/commondialogboxfunctions/of
nhookproc.htm
HTH
B\rgds
100
"Lee Gillie" <ANTISPAMIFICATION_lee@odp.com> wrote in message
news:u2Errej1DHA.3140@tk2msftngp13.phx.gbl...
> WITH MULTISELECT=FALSE: If I make a text box, which is a file path,
> and have a browse button, in the browse click I can set
> OpenFileDialog.FileName to the text box text. Do the Dialog, and then
> restore the text box content from the OpenFileDialog.FileName.
>
> WITH MULTISELECT=TRUE: I can see that after the Dialog I can load the
> text box with VB.Join(OpenFileDialog.FileNames,";") The part I can't
> see is how to get the OpenFileDialog initialized with more than one
> file for the initial display.
>
> Can it even be done?
>
> TIA - Best Regards, Lee Gillie - Spokane, WA
>
>