Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Commdlg 2000 - OPENFILENAME_SIZE_VERSION_400

123 views
Skip to first unread message

anonymous

unread,
Apr 18, 2001, 1:42:24 AM4/18/01
to

Hi,

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.


Tim Robinson

unread,
Apr 18, 2001, 7:07:15 AM4/18/01
to
"anonymous" <nwxyzno...@pc.jaring.my> wrote in message
news:3add2...@news2.tm.net.my...

OPENFILENAME_SIZE_VERSION_400 == sizeof(OPENFILENAME)? Do you want the new
struct size (Win2000) or the old one (Win95)?


anonymous

unread,
Apr 19, 2001, 3:13:27 AM4/19/01
to

Tim Robinson <timothy....@ic.ac.invalid> wrote in message
news:9bjsp1$doo$4...@newsg2.svr.pol.co.uk...

I want the size of Win2000 (new)

TQ.


Tim Robinson

unread,
Apr 19, 2001, 8:48:29 AM4/19/01
to
"anonymous" <nwxyzno...@pc.jaring.my> wrote in message
news:3ade8...@news.tm.net.my...

> > 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)

If you've got the latest Platform SDK, OPENFILENAME is enlarged
appropriately. If not, then sizeof(OPENFILENAME) returns 76 on my machine.


Jeff Henkels

unread,
Apr 19, 2001, 9:02:35 AM4/19/01
to
In general, if you want Win2K-specific features, you need to #define WINVER
and/or _WIN32_WINNT to a value >= 0x0500.

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...>

anonymous

unread,
Apr 19, 2001, 9:18:06 PM4/19/01
to
> OPENFILENAME_SIZE_VERSION_400 == sizeof(OPENFILENAME)? Do you
> want the new struct size (Win2000) or the old one (Win95)?

Hi, I want the struct size - win2000 (Win95 run smooth) for OPENFILENAME ie
OPENFILENAME_SIZE_VERSION_400

TQ

Tim Robinson

unread,
Apr 20, 2001, 7:56:50 AM4/20/01
to
"anonymous" <nwxyzno...@pc.jaring.my> wrote in message
news:3adf8...@news.tm.net.my...

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];
};


0 new messages