Trouble Getting multiple files using Common File Dialog 
Author Message
 Trouble Getting multiple files using Common File Dialog

All,

I am having difficulty retrieving all the filenames selected from the common
file open dialog.  I believe that I have correctly initialized the pointer
to a string buffer large enough and have set the ofn_allowmultiselect flag.
I am having trouble using GetStartPosition and GetNextPathName  in a loop to
retrieve all the filenames.  Can anyone help with a little code snippet??

Thanks,

David



Sun, 15 Oct 2000 03:00:00 GMT  
 Trouble Getting multiple files using Common File Dialog

Quote:

>All,

>I am having difficulty retrieving all the filenames selected from the
common
>file open dialog.  I believe that I have correctly initialized the pointer
>to a string buffer large enough and have set the ofn_allowmultiselect flag.
>I am having trouble using GetStartPosition and GetNextPathName  in a loop
to
>retrieve all the filenames.  Can anyone help with a little code snippet??

>Thanks,

>David

Here goes:

 CString Filetypes;
 Filetypes.LoadString(IDS_OPENFILETYPES);

 CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |
OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT, Filetypes, NULL);

 char*  buff=new char[65535];
 buff[0]='\0';
 dlg.m_ofn.lpstrFile=buff;
 dlg.m_ofn.nMaxFile = 65535;//sizeof(buff);

 POSITION Position;

 if(dlg.DoModal()==IDOK)

   Position=dlg.GetStartPosition();
   while(Position)
   {
     //dlg.GetNextPathName(Position); will give you a path
   }
 }

 delete [] buff;

cU
--

   http://djuga.home.ml.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*NEW*: Retriever 1.1 is out: http://retriever.home.ml.org

Shareware image viewer, thumbnailer & database
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Mon, 16 Oct 2000 03:00:00 GMT  
 Trouble Getting multiple files using Common File Dialog

Quote:
>I am having difficulty retrieving all the filenames selected from the common
>file open dialog.  I believe that I have correctly initialized the pointer
>to a string buffer large enough and have set the ofn_allowmultiselect flag.
>I am having trouble using GetStartPosition and GetNextPathName  in a loop to
>retrieve all the filenames.  Can anyone help with a little code snippet??

David,

There was a problem with the Explorer style dialog under NT4 that was
fixed with SP2.

However, here's a brief example:

        CString FileName;
        POSITION pos;
        pos = dlgFile.GetStartPosition();
        while (pos != NULL)
        {
                FileName = dlgFile.GetNextPathName(pos);

                ...
        }

Dave
----
Address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow up email copies.



Tue, 17 Oct 2000 03:00:00 GMT  
 Trouble Getting multiple files using Common File Dialog

Thanks for the replies, they were a big help.

David.

Quote:

>All,

>I am having difficulty retrieving all the filenames selected from the
common
>file open dialog.  I believe that I have correctly initialized the pointer
>to a string buffer large enough and have set the ofn_allowmultiselect flag.
>I am having trouble using GetStartPosition and GetNextPathName  in a loop
to
>retrieve all the filenames.  Can anyone help with a little code snippet??

>Thanks,

>David



Tue, 17 Oct 2000 03:00:00 GMT  
 Trouble Getting multiple files using Common File Dialog


Fri, 19 Jun 1992 00:00:00 GMT  
 Trouble Getting multiple files using Common File Dialog

Hello,

I'm trying to insert an OLE control in a dialog box, but that
didn't work :

when I'm trying to insert ole in a dialog I have a TRACE :
"
Warning: SetExtent on OLE control (dialog ID 1070) failed.
IOleInPlaceObject not supported on OLE control (dialog ID 1070).

Quote:
>>> Result code: 0x80004002

"

My code is

// when I click on a button named control
void CDanielDlg::Onctrl()
{
        // get CLSID
        COleInsertDialog dial;
        if (dial.DoModal() != IDOK)
                return;
        CLSID clsID  = dial.GetClassID();

        // get the rect of a control in my dialog
        CRect rect;
        m_ctrlCadre.GetWindowRect(rect);
        ScreenToClient( rect );

        // trying to create the control !
        BOOL bOK = m_wndOle.CreateControl( clsID, NULL, WS_VISIBLE, rect, this,
1070 );

Quote:
}

Can someone help ?

thanks
Stephane



Mon, 30 Oct 2000 03:00:00 GMT  
 Trouble Getting multiple files using Common File Dialog

did you add AfxEnableControlContainer in initinstance

--
-------------------------------------------------------
Rajesh Parikh
Microsoft Certified Solution Developer

-------------------------------------------------------

Quote:

>Hello,

>I'm trying to insert an OLE control in a dialog box, but that
>didn't work :

>when I'm trying to insert ole in a dialog I have a TRACE :
>"
>Warning: SetExtent on OLE control (dialog ID 1070) failed.
>IOleInPlaceObject not supported on OLE control (dialog ID 1070).
>>>> Result code: 0x80004002
>"

>My code is

>// when I click on a button named control
>void CDanielDlg::Onctrl()
>{
>        // get CLSID
> COleInsertDialog dial;
> if (dial.DoModal() != IDOK)
> return;
> CLSID clsID  = dial.GetClassID();

>        // get the rect of a control in my dialog
> CRect rect;
> m_ctrlCadre.GetWindowRect(rect);
> ScreenToClient( rect );

>        // trying to create the control !
> BOOL bOK = m_wndOle.CreateControl( clsID, NULL, WS_VISIBLE, rect, this,
>1070 );

>}

>Can someone help ?

>thanks
>Stephane



Mon, 30 Oct 2000 03:00:00 GMT  
 Trouble Getting multiple files using Common File Dialog

From the code it seems like you are trying to insert any OLE insertable object.
So, That would mean the that the object selected in COleInsertDialog might not
be a control after all. So, It might be failing because of that. Moreover,
COleInsertDialog is not the right dialog to use to insert a control. Try to
insert the control before hand without using the dialog and try CreateControl on
that. Or, I think there might already be a dialog for inserting controls. Check
out www.codeguru.com . You might find something there.

--
Girish Bharadwaj  [VC++/MVP]
Please don't send email queries.Post them here.
MS Knowledge base articles : http://support.microsoft.com/support

|Hello,
|
|I'm trying to insert an OLE control in a dialog box, but that
|didn't work :
|
|when I'm trying to insert ole in a dialog I have a TRACE :
|"
|Warning: SetExtent on OLE control (dialog ID 1070) failed.
|IOleInPlaceObject not supported on OLE control (dialog ID 1070).
|>>> Result code: 0x80004002
|"
|
|
|My code is
|
|// when I click on a button named control
|void CDanielDlg::Onctrl()
|{
|        // get CLSID
| COleInsertDialog dial;
| if (dial.DoModal() != IDOK)
| return;
| CLSID clsID  = dial.GetClassID();
|
|        // get the rect of a control in my dialog
| CRect rect;
| m_ctrlCadre.GetWindowRect(rect);
| ScreenToClient( rect );
|
|        // trying to create the control !
| BOOL bOK = m_wndOle.CreateControl( clsID, NULL, WS_VISIBLE, rect, this,
|1070 );
|
|}
|
|
|Can someone help ?
|
|thanks
|Stephane



Mon, 30 Oct 2000 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. File Open Common Dialog multiple selection question

2. Multiple File Selection Common Dialog Limit

3. Select Directory using common file dialog(CFileDialog)

4. Using Common File Dialog

5. Using Serialize function without common file dialog windows

6. File Common Dialog Box with many file types

7. Cannot display the dialog derived from common file dialog

8. Nesting Common File Dialog within my Dialog

9. Common Open Dialog not displaying a dialog when file doesn't exist

10. problems using one header file for multiple source files

11. Selecting multiple files in Win File->Open dialog

12. Creating Files Common to Multiple Projects??

 

 
Powered by phpBB® Forum Software