Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with the CFileDialog Class

Status
Not open for further replies.

stream2000

Programmer
Aug 17, 2002
6
US
I've created a file dialog with multipleselect.
If I'm trying to increase m_ofn.nMaxFile more than 264 it just destroys the window.

The code :
_________________________________
CFileDialog m_ldFile(TRUE);
m_ldFile.m_ofn.nMaxFile = 264;
________________________________

I have no idea what to do
 
Dear Stream2000!

I am not quite sure (I don't have time to look deeper into it:), but I think the reason for this is that if you increase the nMaxFile, you also have to provide a buffer for the m_ldFile.m_ofn.lpstrFile. If you don't provide a buffer the system will not allocate enough memory for all the selected files!
I hope this solves your little problem:)

Best regards

Tomasr
 
OPENFILENAME::nMaxFile specify the buffer size of OPNEFILENAME::lpstrFile. Make sure lpstrFile also has sufficient space.
Code:
    const int MAX_FILE = 1024;
    TCHAR tchFile[MAX_FILE];

    m_ldFile.m_ofn.nMaxFile = MAX_FILE;
    m_ldFile.m_ofn.lpstrFile = tchFile;
    ...
[\code]

HTH
Shyan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top