home *** CD-ROM | disk | FTP | other *** search
/ Supercompiler 1997 / SUPERCOMPILER97.iso / MS_VC.50 / VC / MFC / SRC / AFXIMPL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-30  |  17.8 KB  |  607 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1997 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. #undef AFX_DATA
  12. #define AFX_DATA AFX_CORE_DATA
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // Auxiliary System/Screen metrics
  16.  
  17. struct AUX_DATA
  18. {
  19.     // system metrics
  20.     int cxVScroll, cyHScroll;
  21.     int cxIcon, cyIcon;
  22.  
  23.     int cxBorder2, cyBorder2;
  24.  
  25.     // device metrics for screen
  26.     int cxPixelsPerInch, cyPixelsPerInch;
  27.  
  28.     // convenient system color
  29.     HBRUSH hbrWindowFrame;
  30.     HBRUSH hbrBtnFace;
  31. #ifdef _MAC
  32.     HBRUSH hbr3DLight;
  33. #endif
  34.  
  35.     // color values of system colors used for CToolBar
  36.     COLORREF clrBtnFace, clrBtnShadow, clrBtnHilite;
  37.     COLORREF clrBtnText, clrWindowFrame;
  38. #ifdef _MAC
  39.     COLORREF clr3DLight;
  40. #endif
  41.  
  42.     // standard cursors
  43.     HCURSOR hcurWait;
  44.     HCURSOR hcurArrow;
  45.     HCURSOR hcurHelp;       // cursor used in Shift+F1 help
  46.  
  47.     // special GDI objects allocated on demand
  48.     HFONT   hStatusFont;
  49.     HFONT   hToolTipsFont;
  50.     HBITMAP hbmMenuDot;
  51.  
  52.     // other system information
  53.     UINT    nWinVer;        // Major.Minor version numbers
  54.     BOOL    bWin32s;        // TRUE if Win32s (or Windows 95)
  55.     BOOL    bWin4;          // TRUE if Windows 4.0
  56.     BOOL    bNotWin4;       // TRUE if not Windows 4.0
  57.     BOOL    bSmCaption;     // TRUE if WS_EX_SMCAPTION is supported
  58.     BOOL    bMarked4;       // TRUE if marked as 4.0
  59.  
  60. #ifdef _MAC
  61.     BOOL    bOleIgnoreSuspend;
  62. #endif
  63.  
  64. // Implementation
  65.     AUX_DATA();
  66.     ~AUX_DATA();
  67.     void UpdateSysColors();
  68.     void UpdateSysMetrics();
  69. };
  70.  
  71. extern AFX_DATA AUX_DATA afxData;
  72.  
  73. /////////////////////////////////////////////////////////////////////////////
  74. // _AFX_CTL3D_STATE
  75.  
  76. #undef AFX_DATA
  77. #define AFX_DATA
  78.  
  79. class _AFX_CTL3D_STATE : public CNoTrackObject
  80. {
  81. public:
  82.     virtual ~_AFX_CTL3D_STATE();
  83.  
  84.     // setup during initialization
  85.     BOOL m_bCtl3dInited;
  86.     HINSTANCE m_hCtl3dLib;
  87.  
  88.     // CTL3D32 entry points
  89.     BOOL (WINAPI* m_pfnRegister)(HINSTANCE);
  90.     BOOL (WINAPI* m_pfnUnregister)(HINSTANCE);
  91.     BOOL (WINAPI* m_pfnAutoSubclass)(HINSTANCE);
  92.     BOOL (WINAPI* m_pfnUnAutoSubclass)();
  93.     BOOL (WINAPI* m_pfnColorChange)();
  94.     BOOL (WINAPI* m_pfnSubclassDlgEx)(HWND, DWORD);
  95.     void (WINAPI* m_pfnWinIniChange)();
  96.     BOOL (WINAPI* m_pfnSubclassCtl)(HWND);
  97.     BOOL (WINAPI* m_pfnSubclassCtlEx)(HWND, int);
  98. };
  99.  
  100. EXTERN_PROCESS_LOCAL(_AFX_CTL3D_STATE, _afxCtl3dState)
  101.  
  102. class _AFX_CTL3D_THREAD : public CNoTrackObject
  103. {
  104. public:
  105.     virtual ~_AFX_CTL3D_THREAD();
  106. };
  107.  
  108. EXTERN_THREAD_LOCAL(_AFX_CTL3D_THREAD, _afxCtl3dThread)
  109.  
  110. /////////////////////////////////////////////////////////////////////////////
  111. // _AFX_EDIT_STATE
  112.  
  113. class _AFX_EDIT_STATE : public CNoTrackObject
  114. {
  115. public:
  116.     _AFX_EDIT_STATE();
  117.     virtual ~_AFX_EDIT_STATE();
  118.  
  119.     CFindReplaceDialog* pFindReplaceDlg; // find or replace dialog
  120.     BOOL bFindOnly; // Is pFindReplace the find or replace?
  121.     CString strFind;    // last find string
  122.     CString strReplace; // last replace string
  123.     BOOL bCase; // TRUE==case sensitive, FALSE==not
  124.     int bNext;  // TRUE==search down, FALSE== search up
  125.     BOOL bWord; // TRUE==match whole word, FALSE==not
  126. };
  127.  
  128. #undef AFX_DATA
  129. #define AFX_DATA AFX_CORE_DATA
  130.  
  131. class _AFX_RICHEDIT_STATE : public _AFX_EDIT_STATE
  132. {
  133. public:
  134.     HINSTANCE m_hInstRichEdit;      // handle to RICHED32.DLL
  135.     virtual ~_AFX_RICHEDIT_STATE();
  136. };
  137.  
  138. EXTERN_PROCESS_LOCAL(_AFX_RICHEDIT_STATE, _afxRichEditState)
  139.  
  140. _AFX_RICHEDIT_STATE* AFX_CDECL AfxGetRichEditState();
  141.  
  142. #undef AFX_DATA
  143. #define AFX_DATA
  144.  
  145. _AFX_CTL3D_STATE* AFXAPI AfxGetCtl3dState();
  146.  
  147. ////////////////////////////////////////////////////////////////////////////
  148. // other global state
  149.  
  150. // Note: afxData.cxBorder and afxData.cyBorder aren't used anymore
  151. #define CX_BORDER   1
  152. #define CY_BORDER   1
  153.  
  154. // states for Shift+F1 hep mode
  155. #define HELP_INACTIVE   0   // not in Shift+F1 help mode (must be 0)
  156. #define HELP_ACTIVE     1   // in Shift+F1 help mode (non-zero)
  157. #define HELP_ENTERING   2   // entering Shift+F1 help mode (non-zero)
  158.  
  159. /////////////////////////////////////////////////////////////////////////////
  160. // Window class names and other window creation support
  161.  
  162. // from wincore.cpp
  163. extern const TCHAR _afxWnd[];           // simple child windows/controls
  164. extern const TCHAR _afxWndControlBar[]; // controls with grey backgrounds
  165. extern const TCHAR _afxWndMDIFrame[];
  166. extern const TCHAR _afxWndFrameOrView[];
  167. extern const TCHAR _afxWndOleControl[];
  168.  
  169. #define AFX_WND_REG             (0x0001)
  170. #define AFX_WNDCONTROLBAR_REG   (0x0002)
  171. #define AFX_WNDMDIFRAME_REG     (0x0004)
  172. #define AFX_WNDFRAMEORVIEW_REG  (0x0008)
  173. #define AFX_WNDCOMMCTLS_REG     (0x0010)
  174. #define AFX_WNDOLECONTROL_REG   (0x0020)
  175.  
  176. #define AfxDeferRegisterClass(fClass) \
  177.     ((afxRegisteredClasses & fClass) ? TRUE : AfxEndDeferRegisterClass(fClass))
  178.  
  179. extern BOOL AFXAPI AfxEndDeferRegisterClass(short fClass);
  180.  
  181. #ifndef _UNICODE
  182. #define _UNICODE_SUFFIX
  183. #else
  184. #define _UNICODE_SUFFIX _T("u")
  185. #endif
  186.  
  187. #ifndef _DEBUG
  188. #define _DEBUG_SUFFIX
  189. #else
  190. #define _DEBUG_SUFFIX _T("d")
  191. #endif
  192.  
  193. #ifdef _AFXDLL
  194. #define _STATIC_SUFFIX
  195. #else
  196. #define _STATIC_SUFFIX _T("s")
  197. #endif
  198.  
  199. #define AFX_WNDCLASS(s) \
  200.     _T("Afx") _T(s) _T("42") _STATIC_SUFFIX _UNICODE_SUFFIX _DEBUG_SUFFIX
  201.  
  202. #define AFX_WND             AFX_WNDCLASS("Wnd")
  203. #define AFX_WNDCONTROLBAR   AFX_WNDCLASS("ControlBar")
  204. #define AFX_WNDMDIFRAME     AFX_WNDCLASS("MDIFrame")
  205. #define AFX_WNDFRAMEORVIEW  AFX_WNDCLASS("FrameOrView")
  206. #define AFX_WNDOLECONTROL   AFX_WNDCLASS("OleControl")
  207.  
  208. // dialog/commdlg hook procs
  209. BOOL CALLBACK AfxDlgProc(HWND, UINT, WPARAM, LPARAM);
  210. UINT CALLBACK _AfxCommDlgProc(HWND hWnd, UINT, WPARAM, LPARAM);
  211.  
  212. // support for standard dialogs
  213. extern const UINT _afxNMsgSETRGB;
  214. typedef UINT (CALLBACK* COMMDLGPROC)(HWND, UINT, UINT, LONG);
  215.  
  216. /////////////////////////////////////////////////////////////////////////////
  217. // Extended dialog templates (new in Win95)
  218.  
  219. #pragma pack(push, 1)
  220.  
  221. typedef struct
  222. {
  223.     WORD dlgVer;
  224.     WORD signature;
  225.     DWORD helpID;
  226.     DWORD exStyle;
  227.     DWORD style;
  228.     WORD cDlgItems;
  229.     short x;
  230.     short y;
  231.     short cx;
  232.     short cy;
  233. } DLGTEMPLATEEX;
  234.  
  235. typedef struct
  236. {
  237.     DWORD helpID;
  238.     DWORD exStyle;
  239.     DWORD style;
  240.     short x;
  241.     short y;
  242.     short cx;
  243.     short cy;
  244.     DWORD id;
  245. } DLGITEMTEMPLATEEX;
  246.  
  247. #pragma pack(pop)
  248.  
  249. /////////////////////////////////////////////////////////////////////////////
  250. // Special helpers
  251.  
  252. void AFXAPI AfxCancelModes(HWND hWndRcvr);
  253. HWND AFXAPI AfxGetParentOwner(HWND hWnd);
  254. BOOL AFXAPI AfxIsDescendant(HWND hWndParent, HWND hWndChild);
  255. BOOL AFXAPI AfxHelpEnabled();  // determine if ID_HELP handler exists
  256. void AFXAPI AfxDeleteObject(HGDIOBJ* pObject);
  257. BOOL AFXAPI AfxCustomLogFont(UINT nIDS, LOGFONT* pLogFont);
  258. #if !defined(_MAC) || defined(MACOCX)
  259. BOOL AFXAPI AfxGetPropSheetFont(CString& strFace, WORD& wSize, BOOL bWizard);
  260. #endif
  261.  
  262. BOOL AFXAPI _AfxIsComboBoxControl(HWND hWnd, UINT nStyle);
  263. BOOL AFXAPI _AfxCheckCenterDialog(LPCTSTR lpszResource);
  264. BOOL AFXAPI _AfxCompareClassName(HWND hWnd, LPCTSTR lpszClassName);
  265. HWND AFXAPI _AfxChildWindowFromPoint(HWND, POINT);
  266.  
  267. #ifdef _MAC
  268. BOOL AFXAPI _AfxIdenticalRect(LPCRECT lpRectOne, LPCRECT lpRectTwo);
  269. #else
  270. #define _AfxIdenticalRect EqualRect
  271. #endif
  272.  
  273. // UNICODE/MBCS abstractions
  274. #ifdef _MBCS
  275.     extern AFX_DATA const BOOL _afxDBCS;
  276. #else
  277.     #define _afxDBCS FALSE
  278. #endif
  279.  
  280. // determine number of elements in an array (not bytes)
  281. #define _countof(array) (sizeof(array)/sizeof(array[0]))
  282.  
  283. #ifndef _AFX_PORTABLE
  284. int AFX_CDECL AfxCriticalNewHandler(size_t nSize);
  285. #endif
  286.  
  287. void AFXAPI AfxGlobalFree(HGLOBAL hGlobal);
  288.  
  289. /////////////////////////////////////////////////////////////////////////////
  290. // static exceptions
  291.  
  292. extern CNotSupportedException _simpleNotSupportedException;
  293. extern CMemoryException _simpleMemoryException;
  294. extern CUserException _simpleUserException;
  295. extern CResourceException _simpleResourceException;
  296.  
  297. /////////////////////////////////////////////////////////////////////////////
  298. // useful message ranges
  299.  
  300. #define WM_SYSKEYFIRST  WM_SYSKEYDOWN
  301. #define WM_SYSKEYLAST   WM_SYSDEADCHAR
  302.  
  303. #define WM_NCMOUSEFIRST WM_NCMOUSEMOVE
  304. #define WM_NCMOUSELAST  WM_NCMBUTTONDBLCLK
  305.  
  306.  
  307. /////////////////////////////////////////////////////////////////////////////
  308. // AFX_CRITICAL_SECTION
  309.  
  310. #undef AFX_DATA
  311. #define AFX_DATA AFX_CORE_DATA
  312.  
  313. #ifdef _MAC
  314.  
  315. // WLM makes critical sections in the operating system
  316. // a no-op.  This class stubs to nothing in _MAC builds
  317. // so that no extra useless code is referenced by MFC.
  318.  
  319. #pragma warning(disable: 4097)
  320.  
  321. class CCriticalSection
  322. {
  323. public:
  324.     CCriticalSection() { };
  325.     ~CCriticalSection() { };
  326.  
  327.     BOOL Lock() { return TRUE; };
  328.     BOOL Unlock() { return TRUE; };
  329. };
  330.  
  331. #endif  // _MAC
  332.  
  333. // these globals are protected by the same critical section
  334. #define CRIT_DYNLINKLIST    0
  335. #define CRIT_RUNTIMECLASSLIST   0
  336. #define CRIT_OBJECTFACTORYLIST  0
  337. #define CRIT_LOCKSHARED 0
  338. // these globals are not protected by independent critical sections
  339. #define CRIT_REGCLASSLIST   1
  340. #define CRIT_WAITCURSOR     2
  341. #define CRIT_DROPSOURCE     3
  342. #define CRIT_DROPTARGET     4
  343. #define CRIT_RECTTRACKER    5
  344. #define CRIT_EDITVIEW       6
  345. #define CRIT_WINMSGCACHE    7
  346. #define CRIT_HALFTONEBRUSH  8
  347. #define CRIT_SPLITTERWND    9
  348. #define CRIT_MINIFRAMEWND   10
  349. #define CRIT_CTLLOCKLIST    11
  350. #define CRIT_DYNDLLLOAD     12
  351. #define CRIT_TYPELIBCACHE   13
  352. #define CRIT_STOCKMASK      14
  353. #define CRIT_ODBC           15
  354. #define CRIT_PROCESSLOCAL   16
  355. #define CRIT_MAX    17  // Note: above plus one!
  356.  
  357. #ifdef _MT
  358. void AFXAPI AfxLockGlobals(int nLockType);
  359. void AFXAPI AfxUnlockGlobals(int nLockType);
  360. BOOL AFXAPI AfxCriticalInit();
  361. void AFXAPI AfxCriticalTerm();
  362. #else
  363. #define AfxLockGlobals(nLockType)
  364. #define AfxUnlockGlobals(nLockType)
  365. #define AfxCriticalInit() (TRUE)
  366. #define AfxCriticalTerm()
  367. #endif
  368.  
  369. /////////////////////////////////////////////////////////////////////////////
  370. // Portability abstractions
  371.  
  372. #define _AfxSetDlgCtrlID(hWnd, nID)     SetWindowLong(hWnd, GWL_ID, nID)
  373. #define _AfxGetDlgCtrlID(hWnd)          ((UINT)(WORD)::GetDlgCtrlID(hWnd))
  374.  
  375. // misc helpers
  376. BOOL AFXAPI AfxFullPath(LPTSTR lpszPathOut, LPCTSTR lpszFileIn);
  377. BOOL AFXAPI AfxComparePath(LPCTSTR lpszPath1, LPCTSTR lpszPath2);
  378.  
  379. UINT AFXAPI AfxGetFileTitle(LPCTSTR lpszPathName, LPTSTR lpszTitle, UINT nMax);
  380. UINT AFXAPI AfxGetFileName(LPCTSTR lpszPathName, LPTSTR lpszTitle, UINT nMax);
  381. void AFX_CDECL AfxTimeToFileTime(const CTime& time, LPFILETIME pFileTime);
  382. void AFXAPI AfxGetRoot(LPCTSTR lpszPath, CString& strRoot);
  383.  
  384. #ifndef _AFX_NO_OLE_SUPPORT
  385. class AFX_COM
  386. {
  387. public:
  388.     AFX_COM() {m_hInst = NULL;}
  389.     ~AFX_COM();
  390.     HINSTANCE m_hInst;
  391.     HRESULT CreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
  392.         REFIID riid, LPVOID* ppv);
  393.     HRESULT GetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv);
  394. };
  395.  
  396. CString AFXAPI AfxStringFromCLSID(REFCLSID rclsid);
  397. BOOL AFXAPI AfxGetInProcServer(LPCTSTR lpszCLSID, CString& str);
  398. #endif
  399. #ifndef _MAC
  400. BOOL AFXAPI AfxResolveShortcut(CWnd* pWnd, LPCTSTR pszShortcutFile,
  401.     LPTSTR pszPath, int cchPath);
  402. #endif
  403. #ifdef _MAC
  404. #define AfxGetFileName AfxGetFileTitle
  405. #endif
  406.  
  407. #define NULL_TLS ((DWORD)-1)
  408.  
  409. /////////////////////////////////////////////////////////////////////////////
  410. // Message map and message dispatch
  411.  
  412. const AFX_MSGMAP_ENTRY* AFXAPI
  413. AfxFindMessageEntry(const AFX_MSGMAP_ENTRY* lpEntry,
  414.     UINT nMsg, UINT nCode, UINT nID);
  415.  
  416. union MessageMapFunctions
  417. {
  418.     AFX_PMSG pfn;   // generic member function pointer
  419.  
  420.     // specific type safe variants for WM_COMMAND and WM_NOTIFY messages
  421.     void (AFX_MSG_CALL CCmdTarget::*pfn_COMMAND)();
  422.     BOOL (AFX_MSG_CALL CCmdTarget::*pfn_bCOMMAND)();
  423.     void (AFX_MSG_CALL CCmdTarget::*pfn_COMMAND_RANGE)(UINT);
  424.     BOOL (AFX_MSG_CALL CCmdTarget::*pfn_COMMAND_EX)(UINT);
  425.  
  426.     void (AFX_MSG_CALL CCmdTarget::*pfn_UPDATE_COMMAND_UI)(CCmdUI*);
  427.     void (AFX_MSG_CALL CCmdTarget::*pfn_UPDATE_COMMAND_UI_RANGE)(CCmdUI*, UINT);
  428.     void (AFX_MSG_CALL CCmdTarget::*pfn_OTHER)(void*);
  429.     BOOL (AFX_MSG_CALL CCmdTarget::*pfn_OTHER_EX)(void*);
  430.  
  431.     void (AFX_MSG_CALL CCmdTarget::*pfn_NOTIFY)(NMHDR*, LRESULT*);
  432.     BOOL (AFX_MSG_CALL CCmdTarget::*pfn_bNOTIFY)(NMHDR*, LRESULT*);
  433.     void (AFX_MSG_CALL CCmdTarget::*pfn_NOTIFY_RANGE)(UINT, NMHDR*, LRESULT*);
  434.     BOOL (AFX_MSG_CALL CCmdTarget::*pfn_NOTIFY_EX)(UINT, NMHDR*, LRESULT*);
  435.  
  436.     // type safe variant for thread messages
  437.  
  438.     void (AFX_MSG_CALL CWinThread::*pfn_THREAD)(WPARAM, LPARAM);
  439.  
  440.     // specific type safe variants for WM-style messages
  441.     BOOL    (AFX_MSG_CALL CWnd::*pfn_bD)(CDC*);
  442.     BOOL    (AFX_MSG_CALL CWnd::*pfn_bb)(BOOL);
  443.     BOOL    (AFX_MSG_CALL CWnd::*pfn_bWww)(CWnd*, UINT, UINT);
  444.     BOOL    (AFX_MSG_CALL CWnd::*pfn_bHELPINFO)(HELPINFO*);
  445.     BOOL    (AFX_MSG_CALL CWnd::*pfn_bWCDS)(CWnd*, COPYDATASTRUCT*);
  446.     HBRUSH  (AFX_MSG_CALL CWnd::*pfn_hDWw)(CDC*, CWnd*, UINT);
  447.     HBRUSH  (AFX_MSG_CALL CWnd::*pfn_hDw)(CDC*, UINT);
  448.     int     (AFX_MSG_CALL CWnd::*pfn_iwWw)(UINT, CWnd*, UINT);
  449.     int     (AFX_MSG_CALL CWnd::*pfn_iww)(UINT, UINT);
  450.     int     (AFX_MSG_CALL CWnd::*pfn_iWww)(CWnd*, UINT, UINT);
  451.     int     (AFX_MSG_CALL CWnd::*pfn_is)(LPTSTR);
  452.     LRESULT (AFX_MSG_CALL CWnd::*pfn_lwl)(WPARAM, LPARAM);
  453.     LRESULT (AFX_MSG_CALL CWnd::*pfn_lwwM)(UINT, UINT, CMenu*);
  454.     void    (AFX_MSG_CALL CWnd::*pfn_vv)(void);
  455.  
  456.     void    (AFX_MSG_CALL CWnd::*pfn_vw)(UINT);
  457.     void    (AFX_MSG_CALL CWnd::*pfn_vww)(UINT, UINT);
  458.     void    (AFX_MSG_CALL CWnd::*pfn_vvii)(int, int);
  459.     void    (AFX_MSG_CALL CWnd::*pfn_vwww)(UINT, UINT, UINT);
  460.     void    (AFX_MSG_CALL CWnd::*pfn_vwii)(UINT, int, int);
  461.     void    (AFX_MSG_CALL CWnd::*pfn_vwl)(WPARAM, LPARAM);
  462.     void    (AFX_MSG_CALL CWnd::*pfn_vbWW)(BOOL, CWnd*, CWnd*);
  463.     void    (AFX_MSG_CALL CWnd::*pfn_vD)(CDC*);
  464.     void    (AFX_MSG_CALL CWnd::*pfn_vM)(CMenu*);
  465.     void    (AFX_MSG_CALL CWnd::*pfn_vMwb)(CMenu*, UINT, BOOL);
  466.  
  467.     void    (AFX_MSG_CALL CWnd::*pfn_vW)(CWnd*);
  468.     void    (AFX_MSG_CALL CWnd::*pfn_vWww)(CWnd*, UINT, UINT);
  469.     void    (AFX_MSG_CALL CWnd::*pfn_vWp)(CWnd*, CPoint);
  470.     void    (AFX_MSG_CALL CWnd::*pfn_vWh)(CWnd*, HANDLE);
  471.     void    (AFX_MSG_CALL CWnd::*pfn_vwW)(UINT, CWnd*);
  472.     void    (AFX_MSG_CALL CWnd::*pfn_vwWb)(UINT, CWnd*, BOOL);
  473.     void    (AFX_MSG_CALL CWnd::*pfn_vwwW)(UINT, UINT, CWnd*);
  474.     void    (AFX_MSG_CALL CWnd::*pfn_vwwx)(UINT, UINT);
  475.     void    (AFX_MSG_CALL CWnd::*pfn_vs)(LPTSTR);
  476.     void    (AFX_MSG_CALL CWnd::*pfn_vOWNER)(int, LPTSTR);   // force return TRUE
  477.     int     (AFX_MSG_CALL CWnd::*pfn_iis)(int, LPTSTR);
  478.     UINT    (AFX_MSG_CALL CWnd::*pfn_wp)(CPoint);
  479.     UINT    (AFX_MSG_CALL CWnd::*pfn_wv)(void);
  480.     void    (AFX_MSG_CALL CWnd::*pfn_vPOS)(WINDOWPOS*);
  481.     void    (AFX_MSG_CALL CWnd::*pfn_vCALC)(BOOL, NCCALCSIZE_PARAMS*);
  482.     void    (AFX_MSG_CALL CWnd::*pfn_vwp)(UINT, CPoint);
  483.     void    (AFX_MSG_CALL CWnd::*pfn_vwwh)(UINT, UINT, HANDLE);
  484.     BOOL    (AFX_MSG_CALL CWnd::*pfn_bwsp)(UINT, short, CPoint);
  485.     void    (AFX_MSG_CALL CWnd::*pfn_vws)(UINT, LPCTSTR);
  486. };
  487.  
  488. /////////////////////////////////////////////////////////////////////////////
  489. // Debugging/Tracing helpers
  490.  
  491. #ifdef _DEBUG
  492.     void AFXAPI _AfxTraceMsg(LPCTSTR lpszPrefix, const MSG* pMsg);
  493.     BOOL AFXAPI _AfxCheckDialogTemplate(LPCTSTR lpszResource,
  494.         BOOL bInvisibleChild);
  495. #endif
  496.  
  497. /////////////////////////////////////////////////////////////////////////////
  498. // Macintosh-specific declarations
  499.  
  500. #ifdef _MAC
  501. #include <macname1.h>
  502. #include <Types.h>
  503. #include <QuickDraw.h>
  504. #include <AppleEvents.h>
  505. #include <macname2.h>
  506.  
  507. // Win32 uses macros with parameters for this, which breaks C++ code.
  508. #ifdef GetNextWindow
  509. #undef GetNextWindow
  510. #endif
  511.  
  512. extern AEEventHandlerUPP _afxPfnOpenApp;
  513. extern AEEventHandlerUPP _afxPfnOpenDoc;
  514. extern AEEventHandlerUPP _afxPfnPrintDoc;
  515. extern AEEventHandlerUPP _afxPfnQuit;
  516. extern AEEventHandlerUPP _afxPfnOleAuto;
  517.  
  518. OSErr PASCAL _AfxOpenAppHandler(AppleEvent* pae, AppleEvent* paeReply, long lRefcon);
  519. OSErr PASCAL _AfxOpenDocHandler(AppleEvent* pae, AppleEvent* paeReply, long lRefcon);
  520. OSErr PASCAL _AfxPrintDocHandler(AppleEvent* pae, AppleEvent* paeReply, long lRefcon);
  521. OSErr PASCAL _AfxQuitHandler(AppleEvent* pae, AppleEvent* paeReply, long lRefcon);
  522. OSErr PASCAL _AfxOleAutoHandler(AppleEvent* pae, AppleEvent* paeReply, long lRefcon);
  523.  
  524. void AFXAPI _AfxStripDialogCaption(HINSTANCE hInst, LPCTSTR lpszResource);
  525.  
  526. GDHandle AFXAPI _AfxFindDevice(int x, int y);
  527. BOOL AFXAPI AfxCheckMonochrome(const RECT* pRect);
  528. HFONT AFXAPI _AfxGetHelpFont();
  529.  
  530. struct _AFXWORD
  531. {
  532.     BYTE WordBits[sizeof(WORD)];
  533. };
  534. struct _AFXDWORD
  535. {
  536.     BYTE DwordBits[sizeof(DWORD)];
  537. };
  538.  
  539. struct _AFXFLOAT
  540. {
  541.     BYTE FloatBits[sizeof(float)];
  542. };
  543. struct _AFXDOUBLE
  544. {
  545.     BYTE DoubleBits[sizeof(double)];
  546. };
  547.  
  548. inline void _AfxByteSwap(WORD w, BYTE* pb)
  549. {
  550.     _AFXWORD wAfx;
  551.     *(WORD*)&wAfx = w;
  552.  
  553.     ASSERT(sizeof(WORD) == 2);
  554.  
  555.     *pb++ = wAfx.WordBits[1];
  556.     *pb = wAfx.WordBits[0];
  557. }
  558.  
  559. inline void _AfxByteSwap(DWORD dw, BYTE* pb)
  560. {
  561.     _AFXDWORD dwAfx;
  562.     *(DWORD*)&dwAfx = dw;
  563.  
  564.     ASSERT(sizeof(DWORD) == 4);
  565.  
  566.     *pb++ = dwAfx.DwordBits[3];
  567.     *pb++ = dwAfx.DwordBits[2];
  568.     *pb++ = dwAfx.DwordBits[1];
  569.     *pb = dwAfx.DwordBits[0];
  570. }
  571.  
  572. inline void _AfxByteSwap(float f, BYTE* pb)
  573. {
  574.     _AFXFLOAT fAfx;
  575.     *(float*)&fAfx = f;
  576.  
  577.     ASSERT(sizeof(float) == 4);
  578.  
  579.     *pb++ = fAfx.FloatBits[3];
  580.     *pb++ = fAfx.FloatBits[2];
  581.     *pb++ = fAfx.FloatBits[1];
  582.     *pb = fAfx.FloatBits[0];
  583. }
  584.  
  585. inline void _AfxByteSwap(double d, BYTE* pb)
  586. {
  587.     _AFXDOUBLE dAfx;
  588.     *(double*)&dAfx = d;
  589.  
  590.     ASSERT(sizeof(double) == 8);
  591.  
  592.     *pb++ = dAfx.DoubleBits[7];
  593.     *pb++ = dAfx.DoubleBits[6];
  594.     *pb++ = dAfx.DoubleBits[5];
  595.     *pb++ = dAfx.DoubleBits[4];
  596.     *pb++ = dAfx.DoubleBits[3];
  597.     *pb++ = dAfx.DoubleBits[2];
  598.     *pb++ = dAfx.DoubleBits[1];
  599.     *pb = dAfx.DoubleBits[0];
  600. }
  601. #endif //_MAC
  602.  
  603. #undef AFX_DATA
  604. #define AFX_DATA
  605.  
  606. /////////////////////////////////////////////////////////////////////////////
  607.