Re: CFileDialog GetFileName()
If you are using the debugger in 2005 you can click on the little spy glass
next to the CString in the QuickWatch and you can see more of the string. I
find this to be a much better way of looking at the entire string than the
previous way of having to open a memory window and pull the data item out of
the CString.
You could trace into CFileDialog::GetFileName() and see what is being
returned as the result of the call to this line:
if (GetParent()->SendMessage(CDM_GETSPEC, (WPARAM)MAX_PATH,
(LPARAM)strResult.GetBuffer(MAX_PATH)) < 0)
It looks ot me like they are passing in MAX_PATH as the maximum length for
the file name so it should be working. Are you compiling as Unicode?
MAX_PATH is defined as 260. In the ANSI version it is looking for number of
bytes and in the Unicode version it is looking for the number of characters,
but you shouldn't have to worry about that since you are using CStrings.
Did you check the result of the call to DoModal() to see what it returns?
Tom
"joseramonbravo" <joseramonbravo@discussions.microsoft.com> wrote in message
news:1999287E-5D1B-404E-A4DB-B7F04BBD411C@microsoft.com...
------ I have had trouble with the following code:
CFileDialog cfd(TRUE);
cfd.DoModal();
CString pf,nf;
pf=cfd.GetPathName();
nf=cfd.GetFileName();
------ The trouble is that with a path
C:\Documents and Settings\JR\Mis documentos\Introduzca los datos
necesarios
para realizar la b??squeda del facultativo.doc
------ pf=cfd.GetPathName() works right but
------ nf=cfd.GetFileName() works badly obtaining
Introduzca los datos necesarios para realizar la b??squeda del f
------ instead of the correct
Introduzca los datos necesarios para realizar la b??squeda del
facultativo.doc
------ CAN ANYBODY HELP TO SOLVE THE MISTERY?