Article ID: 176487
Article Last Modified on 10/2/2003
#include <macname1.h> #include <macos/windows.h> #include <macname2.h> #include <afxwin.h>
afxwin.h
afx.h
afxver_.h
afxv_w32.h
windows.h // for Macintosh targets this is mac/include/windows.h
winwlm.h // where GetWrapperWindow, and so on, are prototyped
macname2.h //
However, the Winwlm.h file excludes many symbols if certain native
Macintosh header files are not previously included. For example,
GetWrapperWindow is defined if MACOS\Windows.h is included beforehand. This
behavior occurs because GetWrapperWindow, along with other symbols, is in a
section dependent upon __WINDOWS__ being defined. MACOS\Windows.h defines
__WINDOWS__ .
Symbol Include ------ ---------------- CFragConnectionID macos/codefrag.h //__CODEFRAGMENTS__ CFragInitBlockPtr WlmInit WlmTerm WrapInstance UnwrapInstance GetMacInstanceInformation MenuRef macos/menus.h //__MENUS__ WlmInitEx CheckoutMenu WrapMenu UnwrapMenu UpdateMenuBar WindowRef macos/windows.h //__WINDOWS__ ActivateForeignWindow GetWindowWrapper GetWrapperWindow GetWrapperContainerWindow WrapWindow WrapWindowMinimal UnwrapWindow DialogRef macos/dialogs.h //__DIALOGS__ AfxGetNextEvent macos/events.h //__EVENTS__ AfxWaitNextEvent AfxEventAvail AfxGetOSEvent AfxOSEventAvail GrafPortToClient macos/types.h //__TYPES__If these header files are not included, the following error messages are generated: If the following errors occur after including these headers it is because the Afxcmn.h header file was included later. The Afxcmn.h header file contains GetItem and SetItem member functions of several MFC classes that conflict with the ones defined in MACOS\Menus.h. For example:
// macos/Menus.h #if OLDROUTINENAMES ... #define SetItem(theMenu, item, itemString) SetMenuItemText(theMenu, item, itemString) #define GetItem(theMenu, item, itemString) GetMenuItemText(theMenu, item, itemString) ... #endif // OLDROUTINENAMESThe workaround is to define OLDROUTINENAMES as 0. Below is an example of a typical MFC project's Stdafx.h file. This project uses the common controls. For example:
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #include <macname1.h> #define OLDROUTINENAMES 0 #include <macos/windows.h> #include <macname2.h> #include <afxwin.h> // includes Winwlm.h #include <afxext.h> #include <afxcmn.h>
Keywords: kberrmsg kbprb KB176487