PDA

View Full Version : CFileDialog.GetFileName limited to 64 chars?


Koepi
26th May 2002, 17:01
Damn. I'm just playing around with the XCDBackupCreator but it seems that there's an severe issue with these M$ filedialogs :(

Goggle search didn't bring up anything useful, neither did MSDN.

Anyone have a solution for this?

Regards,
Koepi

Nic
27th May 2002, 10:50
Have you sorted this already Koepi? Have you tried changing the values in m_ofn ?

Ive never used CFileDialog...you could try:

static BOOL SelectFileName(HWND hParent, char *filename, BOOL forReading,char *filter,char *ext, bool MultipleInput = false)
{

OPENFILENAME ofn;

ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hParent;
ofn.hInstance = NULL;//hInstance;
ofn.nFilterIndex = 0;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 260;//31;
filename [0] = 0x00;
ofn.lpstrFile = (LPSTR)filename;
ofn.nMaxFile = _MAX_PATH;
ofn.lpstrInitialDir = "."; // make null for mydocuments
ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = 0;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lCustData = 0;
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;

if (forReading)
{
ofn.lpstrFilter = filter;
ofn.lpstrDefExt = ext;//"wav"; incase the user forgets to add extension // can be NULL

if ( MultipleInput )
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT;
else
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;

ofn.lpstrTitle = "Select Source File";

return GetOpenFileName (&ofn);
} else {

ofn.lpstrFilter = filter;
ofn.lpstrDefExt = ext;//"aac";

ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
ofn.lpstrTitle = "Select Output File";

return GetSaveFileName(&ofn);
}
}
Then call using something like:
char szTemp[MAX_PATH];
SelectFileName(hWnd, szTemp, false, "VOB File (*.vob)\0*.vob\0\0", "vob");

That might help if you get real stuck.

-Nic