home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / msj / v10n08 / oleq0895.exe / AFXIMPL.H next >
C/C++ Source or Header  |  1995-08-01  |  9KB  |  277 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992 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 Microsoft
  7. // QuickHelp 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.     int cySysFont;
  28.  
  29.     // solid brushes with convenient gray colors and system colors
  30.     HBRUSH hbrLtGray, hbrDkGray;
  31.     HBRUSH hbrBtnHilite, hbrBtnFace, hbrBtnShadow;
  32.     HBRUSH hbrWindowFrame;
  33.     HPEN hpenBtnHilite, hpenBtnShadow, hpenBtnText;
  34.  
  35.     // color values of system colors used for CToolBar
  36.     COLORREF clrBtnFace, clrBtnShadow, clrBtnHilite;
  37.     COLORREF clrBtnText, clrWindowFrame;
  38.  
  39.     // standard cursors
  40.     HCURSOR hcurWait;
  41.     HCURSOR hcurArrow;
  42.     HCURSOR hcurHelp;       // cursor used in Shift+F1 help
  43.  
  44.     // special GDI objects allocated on demand
  45.     HFONT   hStatusFont;
  46.     HFONT   hToolTipsFont;
  47.     HBITMAP hbmMenuDot;
  48.  
  49.     // other system information
  50.     UINT    nWinVer;        // Major.Minor version numbers
  51.     BOOL    bWin32s;        // TRUE if Win32s (or Windows 95)
  52.     BOOL    bWin4;          // TRUE if Windows 4.0
  53.     BOOL    bNotWin4;       // TRUE if not Windows 4.0
  54.     BOOL    bSmCaption;     // TRUE if WS_EX_SMCAPTION is supported
  55.     BOOL    bWin31;         // TRUE if actually Win32s on Windows 3.1
  56.     BOOL    bMarked4;        // TRUE if marked as 4.0
  57.  
  58.     // special Windows API entry points
  59.     int (WINAPI* pfnSetScrollInfo)(HWND, int, LPCSCROLLINFO, BOOL);
  60.     BOOL (WINAPI* pfnGetScrollInfo)(HWND, int, LPSCROLLINFO);
  61.  
  62. // Implementation
  63.     AUX_DATA();
  64.     ~AUX_DATA();
  65.     void UpdateSysColors();
  66.     void UpdateSysMetrics();
  67. };
  68.  
  69. extern AFX_DATA AUX_DATA afxData;
  70.  
  71. ////////////////////////////////////////////////////////////////////////////
  72. // other global state
  73.  
  74. #ifdef _WINDLL
  75.     extern DWORD _afxAppTlsIndex;
  76.     extern AFX_APP_STATE* _afxAppState;
  77. #endif
  78. extern DWORD _afxThreadTlsIndex;
  79.  
  80. // Note: afxData.cxBorder and afxData.cyBorder aren't used anymore
  81. #define CX_BORDER   1
  82. #define CY_BORDER   1
  83.  
  84. // states for Shift+F1 hep mode
  85. #define HELP_INACTIVE   0   // not in Shift+F1 help mode (must be 0)
  86. #define HELP_ACTIVE     1   // in Shift+F1 help mode (non-zero)
  87. #define HELP_ENTERING   2   // entering Shift+F1 help mode (non-zero)
  88.  
  89. /////////////////////////////////////////////////////////////////////////////
  90. // Window class names and other window creation support
  91.  
  92. // from wincore.cpp
  93. extern const TCHAR _afxWnd[];           // simple child windows/controls
  94. extern const TCHAR _afxWndControlBar[]; // controls with grey backgrounds
  95. extern const TCHAR _afxWndMDIFrame[];
  96. extern const TCHAR _afxWndFrameOrView[];
  97.  
  98. LRESULT CALLBACK AfxDlgProc(HWND, UINT, WPARAM, LPARAM);
  99. UINT CALLBACK _AfxCommDlgProc(HWND hWnd, UINT, WPARAM, LPARAM);
  100.  
  101. // Support for standard dialogs
  102. extern const UINT _afxNMsgSETRGB;
  103. typedef UINT (CALLBACK* COMMDLGPROC)(HWND, UINT, UINT, LONG);
  104.  
  105. /////////////////////////////////////////////////////////////////////////////
  106. // Special helpers
  107.  
  108. HWND AFXAPI AfxGetSafeOwner(CWnd* pParent, HWND* phTopLevel = NULL);
  109. void AFXAPI AfxCancelModes(HWND hWndRcvr);
  110. HWND AFXAPI AfxGetParentOwner(HWND hWnd);
  111. BOOL AFXAPI AfxIsDescendant(HWND hWndParent, HWND hWndChild);
  112. BOOL AFXAPI AfxHelpEnabled();  // determine if ID_HELP handler exists
  113. void AFXAPI AfxDeleteObject(HGDIOBJ* pObject);
  114. BOOL AFXAPI AfxCustomLogFont(UINT nIDS, LOGFONT* pLogFont);
  115.  
  116. BOOL AFXAPI _AfxIsComboBoxControl(HWND hWnd, UINT nStyle);
  117. BOOL AFXAPI _AfxCheckCenterDialog(LPCTSTR lpszResource);
  118.  
  119. #ifdef _MAC
  120. BOOL AFXAPI _AfxIdenticalRect(LPCRECT lpRectOne, LPCRECT lpRectTwo);
  121. #else
  122. #define _AfxIdenticalRect EqualRect
  123. #endif
  124.  
  125. // UNICODE/MBCS abstractions
  126. #ifdef _MBCS
  127.     extern const BOOL _afxDBCS;
  128. #else
  129.     #define _afxDBCS FALSE
  130. #endif
  131.  
  132. // determine number of elements in an array (not bytes)
  133. #define _countof(array) (sizeof(array)/sizeof(array[0]))
  134.  
  135. #define UNUSED  // usage: UNUSED formal_arg
  136.  
  137. /////////////////////////////////////////////////////////////////////////////
  138. // useful message ranges
  139.  
  140. #define WM_SYSKEYFIRST  WM_SYSKEYDOWN
  141. #define WM_SYSKEYLAST   WM_SYSDEADCHAR
  142.  
  143. #define WM_NCMOUSEFIRST WM_NCMOUSEMOVE
  144. #define WM_NCMOUSELAST  WM_NCMBUTTONDBLCLK
  145.  
  146. /////////////////////////////////////////////////////////////////////////////
  147. // AFX_CRITICAL_SECTION
  148.  
  149. #pragma warning(disable: 4097)
  150.  
  151. class AFX_CRITICAL_SECTION : public CRITICAL_SECTION
  152. {
  153. // Constructors & Operations
  154. public:
  155.     AFX_CRITICAL_SECTION();
  156.  
  157. // Attributes
  158.     operator CRITICAL_SECTION*();
  159.  
  160. // Implementation
  161. public:
  162.     ~AFX_CRITICAL_SECTION();
  163.  
  164. private:
  165.     // no implementation (CRITICAL_SECTION objects cannot be copied)
  166.     AFX_CRITICAL_SECTION(const AFX_CRITICAL_SECTION&);
  167.     void operator=(const AFX_CRITICAL_SECTION&);
  168. };
  169.  
  170. inline AFX_CRITICAL_SECTION::AFX_CRITICAL_SECTION()
  171.     { ::InitializeCriticalSection(this); }
  172. inline AFX_CRITICAL_SECTION::operator CRITICAL_SECTION*()
  173.     { return (CRITICAL_SECTION*)this; }
  174. inline AFX_CRITICAL_SECTION::~AFX_CRITICAL_SECTION()
  175.     { ::DeleteCriticalSection(this); }
  176.  
  177. #pragma warning(default: 4097)
  178.  
  179. // global critical section for general thread safe access
  180. extern AFX_DATA AFX_CRITICAL_SECTION _afxCriticalSection;
  181.  
  182. /////////////////////////////////////////////////////////////////////////////
  183. // Portability abstractions
  184.  
  185. #define _AfxSetDlgCtrlID(hWnd, nID)     SetWindowLong(hWnd, GWL_ID, nID)
  186. #define _AfxGetDlgCtrlID(hWnd)          ((UINT)(WORD)::GetDlgCtrlID(hWnd))
  187.  
  188. // misc helpers
  189. BOOL AFXAPI AfxFullPath(LPTSTR lpszPathOut, LPCTSTR lpszFileIn);
  190. BOOL AFXAPI AfxComparePath(LPCTSTR lpszPath1, LPCTSTR lpszPath2);
  191. UINT AFXAPI AfxGetFileTitle(LPCTSTR lpszPathName, LPTSTR lpszTitle, UINT nMax);
  192. UINT AFXAPI AfxGetFileName(LPCTSTR lpszPathName, LPTSTR lpszTitle, UINT nMax);
  193. #ifdef _MAC
  194. #define AfxGetFileName AfxGetFileTitle
  195. #endif
  196.  
  197. const AFX_MSGMAP_ENTRY* AFXAPI
  198. AfxFindMessageEntry(const AFX_MSGMAP_ENTRY* lpEntry,
  199.     UINT nMsg, UINT nCode, UINT nID);
  200.  
  201. #define NULL_TLS ((DWORD)-1)
  202.  
  203. /////////////////////////////////////////////////////////////////////////////
  204. // Debugging/Tracing helpers
  205.  
  206. #ifdef _DEBUG
  207.     void AFXAPI _AfxTraceMsg(LPCTSTR lpszPrefix, const MSG* pMsg);
  208.     BOOL AFXAPI _AfxCheckDialogTemplate(LPCTSTR lpszResource,
  209.         BOOL bInvisibleChild);
  210. #endif
  211.  
  212. /////////////////////////////////////////////////////////////////////////////
  213. // Win4 specific defines
  214.  
  215. #if (WINVER < 0x400)
  216.  
  217. // new window styles
  218. #define WS_EX_SMCAPTION         0x00000080L
  219. #define WS_EX_WINDOWEDGE        0x00000100L
  220. #define WS_EX_CLIENTEDGE        0x00000200L
  221.  
  222. // new dialog styles
  223. #define DS_3DLOOK               0x00000004L
  224.  
  225. // new scroll bar styles
  226. #define SBS_SIZEGRIP            0x00000010L
  227.  
  228. // new common dialog flags
  229. #define OFN_EXPLORER            0x00080000L
  230.  
  231. // new color metrics
  232. #define COLOR_INFOTEXT            23
  233. #define COLOR_INFOBK            24
  234.  
  235. #endif //(WINVER < 0x400)
  236.  
  237. #ifndef WS_EX_SMCAPTION
  238. #define WS_EX_SMCAPTION WS_EX_TOOLWINDOW
  239. #endif
  240.  
  241. #ifndef WM_DISPLAYCHANGE
  242. #define WM_DISPLAYCHANGE        0x007E
  243. #endif
  244.  
  245. /////////////////////////////////////////////////////////////////////////////
  246. // Macintosh-specific declarations
  247.  
  248. #ifdef _MAC
  249. #include <macname1.h>
  250. #include <Types.h>
  251. #include <QuickDraw.h>
  252. #include <AppleEvents.h>
  253. #include <macname2.h>
  254.  
  255. extern AEEventHandlerUPP _afxPfnOpenApp;
  256. extern AEEventHandlerUPP _afxPfnOpenDoc;
  257. extern AEEventHandlerUPP _afxPfnPrintDoc;
  258. extern AEEventHandlerUPP _afxPfnQuit;
  259.  
  260. OSErr PASCAL _AfxOpenAppHandler(AppleEvent* pae, AppleEvent* paeReply, long lRefcon);
  261. OSErr PASCAL _AfxOpenDocHandler(AppleEvent* pae, AppleEvent* paeReply, long lRefcon);
  262. OSErr PASCAL _AfxPrintDocHandler(AppleEvent* pae, AppleEvent* paeReply, long lRefcon);
  263. OSErr PASCAL _AfxQuitHandler(AppleEvent* pae, AppleEvent* paeReply, long lRefcon);
  264.  
  265. void AFXAPI _AfxStripDialogCaption(HINSTANCE hInst, LPCTSTR lpszResource);
  266.  
  267. GDHandle AFXAPI _AfxFindDevice(int x, int y);
  268. BOOL AFXAPI AfxCheckMonochrome(const RECT* pRect);
  269. HFONT AFXAPI _AfxGetHelpFont();
  270.  
  271. #endif //_MAC
  272.  
  273. #undef AFX_DATA
  274. #define AFX_DATA
  275.  
  276. /////////////////////////////////////////////////////////////////////////////
  277.