www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/01/12:31:56

Message-ID: <366427DF.96FB9779@montana.com>
Date: Tue, 01 Dec 1998 10:31:11 -0700
From: bowman <bowman AT montana DOT com>
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: "djgpp AT delorie DOT com" <djgpp AT delorie DOT com>
Subject: RSXNTDJ and anonymous unions
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019