In commondialog, GetSaveFileName required OPENFILENAME structure,
the lStructSize required the value of OPENFILENAME_SIZE_VERSION_400
on Win2000 platform (According to MSDN).
However, I couldn't get this value (included commdlg.h and windows.h),
compile
report error.
Any help is appreciated.
OPENFILENAME_SIZE_VERSION_400 == sizeof(OPENFILENAME)? Do you want the new
struct size (Win2000) or the old one (Win95)?
I want the size of Win2000 (new)
TQ.
If you've got the latest Platform SDK, OPENFILENAME is enlarged
appropriately. If not, then sizeof(OPENFILENAME) returns 76 on my machine.
Looking in <commdlg.h> from the most recent Platform SDK, with _WIN32_WINNT
>= 0x0500, the OPENFILENAME struct has 3 new fields at the end of the struct
(12 bytes total), so that sizeof(OPENFILENAME) !=
OPENFILENAME_SIZE_VERSION_400 -- this makes sense, since
OPENFILENAME_SIZE_VERSION_400 should be the size of the struct under Win32
version 4 (i.e. not Win2K). Note that OPENFILENAME_SIZE_VERSION_400 is
defined if and only if _WIN32_WINNT >= 0x0500, which is probably why you're
getting the compile error.
Since you don't have _WIN32_WINNT >= 0x0500, you should be able to get away
with setting lStructSize = sizeof(OPENFILENAME). The entire business of
OPENFILENAME_SIZE_VERSION_400 applies only when you're compiling with
_WIN32_WINNT >= 0x0500 -- it's basically a kludge to allow backwards
compatibility with Win 2K's extended OPENFILENAME struct. Note, however,
that you won't get the extra functionality in the Win2K open/save file
dialogs (an Outlook-style Places bar on the left-hand side of the dialog);
no big loss, IMHO.
There's a note in the April 2001 MSDN Library entry for the OPENFILENAME
struct that explains this in a bit more detail. Basically, if you're
building with _WIN32_WINNT >= 0x0500, and your app needs to run on Win
95/98/NT4, set lStructName to OPENFILENAME_SIZE_VERSION_400. If your app is
for Win2K or later, you can set lStructName to sizeof(OPENFILENAME).
If you really want to be up-to-the-minute (i.e. show the places bar where
it's available), you would compile with _WIN32_WINNT = 0x0500, and set the
appropriate members to the appropriate values depending on what OS you're
running under.
"anonymous" <nwxyzno...@pc.jaring.my> wrote in message
news:3ade8...@news.tm.net.my...>
Hi, I want the struct size - win2000 (Win95 run smooth) for OPENFILENAME ie
OPENFILENAME_SIZE_VERSION_400
TQ
I have the latest version of the Windows headers, and I can't find
OPENFILENAME_SIZE_VERSION_400 defined anywhere. However,
sizeof(OPENFILENAME) == 76 on my machine, which is the same thing.
If you're using the old OPENFILENAME but with cbSize = 76, you should
probably make sure that it is at least 76 bytes long. You could allocate it
with malloc, or you could declare it in a union with a 76-byte buffer:
// at least 76 bytes will be reserved at all times
union
{
OPENFILENAME ofn;
BYTE pad[76];
};