Mail Archives: djgpp/1998/12/01/12:31:56
There seems to be some rsxntdj traffic, so while I am thinking of it..
many Windows structures are defined using anonymous unions. For
instance,
typedef struct _PROPSHEETPAGE
{
DWORD dwSiae;
DWORD dwFlags;
HINSTANCE hInstance
union
{
LPCTSTR pszTemplate;
LPDLGTEMPLATE pResource;
};
union
{
HICON hIcon;
LPCTSTR pszIcon;\
};
......
} PROPSHEETPAGE;
Part of the patches to the sdk header files consists of adding u, u1,
etc, so that the union has a name. Occasionlly, the header files will
have macros to insert dummy union names.
Most code imported from VC, or examples in many of the popular books,
will read:
PROPSHEETPAGE psp;
psp.pszTemplate = "IDD_FOO";
Under djgpp, anonymous unions are not supported, and this will fail,
with the error
"structure has no member named pszTemplate"
The solution is to go to /rsxntdj/include/mssdk, and 'grep PROPSHEETPAGE
*.h' to locate the definition. Then you can determine what the name of
the union in question is, and write,
psp.u.pszTemplate = "IDD_FOO";
Note that with the original MS DUMMYUNIONNAME macros, there is no 'u1',
just u, u2, and u3.
- Raw text -