From: LFSoftDev on 16 Jan 2009 12:04
>So, you signaled a problem from MSDN code, which instead appeared fine for
Apologies if this was badly worded. I meant that because I had pasted that
code in where the dialog should be called I did not think that the error was
related to the code but possibly some project setting or other setting - like
the windows version you raised.
>So, my understanding is that you were actually using Windows Vista (not XP),
>and you got the failure: this is the problem.
I am using Vista as stated but I would like my program to run on XP as well
as Vista. I thought that in the previous message that is what you were
>Do your own tests, comparing also the test-project I posted
I have been doing that and also explained why I was unable to do it before.
Thank you again for the test program.
I am continuing to look at the windows version and will post my results when
I have something conclusive.
From: Daniel James on 17 Jan 2009 14:19
In article news:<VA.00001648.008d675b(a)nospam.aaisp.org>, I wrote:
> If it's run on Vista in the Vista style then it should use Vista
> styling, if it's run on something other than Vista or on Vista with
> the Classic style then it should not use the classic style ...
I meant "should not use the Vista style", obviously.
From: LFSoftDev on 20 Jan 2009 19:37
I tested the WIN version and it was the same, although declared in a
different file. However, while reaserching this I came accross a solution. I
have removed the vista file menu by changing the parameter to false. I agree
Daniel, I find this strange. I have also added an enable hook flag.
The file menu looks a bit old school but it works. Unfortuantely, I don't
really know why it works now and not before but at least it does.
Thanks for the help.
// Create dialog to open multiple files.
CFileDialog dlg(TRUE, _T("txt"), _T("*.txt"), OFN_ALLOWMULTISELECT,
0,this,0,false);//these parameters added to stop using vista stuff
//this added to prevent crash.
dlg.m_ofn.Flags = OFN_ENABLEHOOK;
// Create buffer for file names.
const DWORD numberOfFileNames = 100;
const DWORD fileNameMaxLength = MAX_PATH + 1;
const DWORD bufferSize = (numberOfFileNames * fileNameMaxLength) + 1;
TCHAR* filenamesBuffer = new TCHAR[bufferSize];
// Initialize beginning and end of buffer.
filenamesBuffer = NULL;
filenamesBuffer[bufferSize-1] = NULL;
// Attach buffer to OPENFILENAME member.
dlg.m_ofn.lpstrFile = filenamesBuffer;
dlg.m_ofn.nMaxFile = bufferSize;
// Create array for file names.
if(dlg.DoModal() == IDOK)
// Retrieve file name(s).
POSITION fileNamesPosition = dlg.GetStartPosition();
int iCtr = 0;
while(fileNamesPosition != NULL)
fileNameArray[iCtr] = dlg.GetNextPathName(fileNamesPosition);
// Release file names buffer.