Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

740 lines
36 KiB

  1. // Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1993 Microsoft Corporation,
  3. // All rights reserved.
  4. // This source code is only intended as a supplement to the
  5. // Microsoft Foundation Classes Reference and Microsoft
  6. // QuickHelp and/or WinHelp documentation provided with the library.
  7. // See these sources for detailed information regarding the
  8. // Microsoft Foundation Classes product.
  9. // Inlines for AFXWIN.H (part 1)
  10. #ifdef _AFXWIN_INLINE
  11. /////////////////////////////////////////////////////////////////////////////
  12. // Global helper functions
  13. #ifndef _AFXDLL
  14. _AFXWIN_INLINE CWinApp* AFXAPI AfxGetApp()
  15. { return afxCurrentWinApp; }
  16. _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()
  17. { ASSERT(afxCurrentInstanceHandle != NULL);
  18. return afxCurrentInstanceHandle; }
  19. _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()
  20. { ASSERT(afxCurrentResourceHandle != NULL);
  21. return afxCurrentResourceHandle; }
  22. _AFXWIN_INLINE void AFXAPI AfxSetResourceHandle(HINSTANCE hInstResource)
  23. { ASSERT(hInstResource != NULL); afxCurrentResourceHandle = hInstResource; }
  24. _AFXWIN_INLINE const char* AFXAPI AfxGetAppName()
  25. { ASSERT(afxCurrentAppName != NULL); return afxCurrentAppName; }
  26. #else //_AFXDLL
  27. _AFXWIN_INLINE CWinApp* AFXAPI AfxGetApp()
  28. { return _AfxGetAppData()->appCurrentWinApp; }
  29. _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()
  30. { ASSERT(_AfxGetAppData()->appCurrentInstanceHandle != NULL);
  31. return _AfxGetAppData()->appCurrentInstanceHandle; }
  32. _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()
  33. { ASSERT(_AfxGetAppData()->appCurrentResourceHandle != NULL);
  34. return _AfxGetAppData()->appCurrentResourceHandle; }
  35. _AFXWIN_INLINE void AFXAPI AfxSetResourceHandle(HINSTANCE hInstResource)
  36. { ASSERT(hInstResource != NULL);
  37. _AfxGetAppData()->appCurrentResourceHandle = hInstResource; }
  38. _AFXWIN_INLINE const char* AFXAPI AfxGetAppName()
  39. { ASSERT(_AfxGetAppData()->appCurrentAppName != NULL);
  40. return _AfxGetAppData()->appCurrentAppName; }
  41. #ifdef _AFXCTL
  42. _AFXWIN_INLINE AFX_MAINTAIN_STATE::AFX_MAINTAIN_STATE(AFX_APPDATA_MODULE* psData)
  43. { m_psPrevious = AfxPushModuleContext(psData); }
  44. _AFXWIN_INLINE AFX_MAINTAIN_STATE::~AFX_MAINTAIN_STATE()
  45. { if (m_psPrevious != NULL)
  46. AfxPopModuleContext(m_psPrevious); }
  47. #endif
  48. #endif //_AFXDLL
  49. #ifdef _AFXCTL
  50. _AFXWIN_INLINE CWnd* AFXAPI AfxGetMainWnd()
  51. { HWND hwnd = ::GetActiveWindow();
  52. return (hwnd != NULL && GetWindowTask(hwnd) == GetCurrentTask()) ?
  53. CWnd::FromHandle(hwnd) : NULL; }
  54. #else
  55. _AFXWIN_INLINE CWnd* AFXAPI AfxGetMainWnd()
  56. { return AfxGetApp() != NULL ? AfxGetApp()->GetMainWnd() : NULL; }
  57. #endif
  58. _AFXWIN_INLINE COleMessageFilter* AFXAPI AfxOleGetMessageFilter()
  59. { ASSERT_VALID(AfxGetApp()); return AfxGetApp()->m_pMessageFilter; }
  60. // CSize
  61. _AFXWIN_INLINE CSize::CSize()
  62. { /* random filled */ }
  63. _AFXWIN_INLINE CSize::CSize(int initCX, int initCY)
  64. { cx = initCX; cy = initCY; }
  65. _AFXWIN_INLINE CSize::CSize(SIZE initSize)
  66. { *(SIZE*)this = initSize; }
  67. _AFXWIN_INLINE CSize::CSize(POINT initPt)
  68. { *(POINT*)this = initPt; }
  69. _AFXWIN_INLINE CSize::CSize(DWORD dwSize)
  70. { *(DWORD*)this = dwSize; }
  71. _AFXWIN_INLINE BOOL CSize::operator==(SIZE size) const
  72. { return (cx == size.cx && cy == size.cy); }
  73. _AFXWIN_INLINE BOOL CSize::operator!=(SIZE size) const
  74. { return (cx != size.cx || cy != size.cy); }
  75. _AFXWIN_INLINE void CSize::operator+=(SIZE size)
  76. { cx += size.cx; cy += size.cy; }
  77. _AFXWIN_INLINE void CSize::operator-=(SIZE size)
  78. { cx -= size.cx; cy -= size.cy; }
  79. _AFXWIN_INLINE CSize CSize::operator+(SIZE size) const
  80. { return CSize(cx + size.cx, cy + size.cy); }
  81. _AFXWIN_INLINE CSize CSize::operator-(SIZE size) const
  82. { return CSize(cx - size.cx, cy - size.cy); }
  83. _AFXWIN_INLINE CSize CSize::operator-() const
  84. { return CSize(-cx, -cy); }
  85. // CPoint
  86. _AFXWIN_INLINE CPoint::CPoint()
  87. { /* random filled */ }
  88. _AFXWIN_INLINE CPoint::CPoint(int initX, int initY)
  89. { x = initX; y = initY; }
  90. _AFXWIN_INLINE CPoint::CPoint(POINT initPt)
  91. { *(POINT*)this = initPt; }
  92. _AFXWIN_INLINE CPoint::CPoint(SIZE initSize)
  93. { *(SIZE*)this = initSize; }
  94. _AFXWIN_INLINE CPoint::CPoint(DWORD dwPoint)
  95. { *(DWORD*)this = dwPoint; }
  96. _AFXWIN_INLINE void CPoint::Offset(int xOffset, int yOffset)
  97. { x += xOffset; y += yOffset; }
  98. _AFXWIN_INLINE void CPoint::Offset(POINT point)
  99. { x += point.x; y += point.y; }
  100. _AFXWIN_INLINE void CPoint::Offset(SIZE size)
  101. { x += size.cx; y += size.cy; }
  102. _AFXWIN_INLINE BOOL CPoint::operator==(POINT point) const
  103. { return (x == point.x && y == point.y); }
  104. _AFXWIN_INLINE BOOL CPoint::operator!=(POINT point) const
  105. { return (x != point.x || y != point.y); }
  106. _AFXWIN_INLINE void CPoint::operator+=(SIZE size)
  107. { x += size.cx; y += size.cy; }
  108. _AFXWIN_INLINE void CPoint::operator-=(SIZE size)
  109. { x -= size.cx; y -= size.cy; }
  110. _AFXWIN_INLINE CPoint CPoint::operator+(SIZE size) const
  111. { return CPoint(x + size.cx, y + size.cy); }
  112. _AFXWIN_INLINE CPoint CPoint::operator-(SIZE size) const
  113. { return CPoint(x - size.cx, y - size.cy); }
  114. _AFXWIN_INLINE CPoint CPoint::operator-() const
  115. { return CPoint(-x, -y); }
  116. _AFXWIN_INLINE CSize CPoint::operator-(POINT point) const
  117. { return CSize(x - point.x, y - point.y); }
  118. // CRect
  119. _AFXWIN_INLINE CRect::CRect()
  120. { /* random filled */ }
  121. _AFXWIN_INLINE CRect::CRect(int l, int t, int r, int b)
  122. { left = l; top = t; right = r; bottom = b; }
  123. _AFXWIN_INLINE CRect::CRect(const RECT& srcRect)
  124. { ::CopyRect(this, &srcRect); }
  125. _AFXWIN_INLINE CRect::CRect(LPCRECT lpSrcRect)
  126. { ::CopyRect(this, lpSrcRect); }
  127. _AFXWIN_INLINE CRect::CRect(POINT point, SIZE size)
  128. { right = (left = point.x) + size.cx; bottom = (top = point.y) + size.cy; }
  129. _AFXWIN_INLINE int CRect::Width() const
  130. { return right - left; }
  131. _AFXWIN_INLINE int CRect::Height() const
  132. { return bottom - top; }
  133. _AFXWIN_INLINE CSize CRect::Size() const
  134. { return CSize(right - left, bottom - top); }
  135. _AFXWIN_INLINE CPoint& CRect::TopLeft()
  136. { return *((CPoint*)this); }
  137. _AFXWIN_INLINE CPoint& CRect::BottomRight()
  138. { return *((CPoint*)this+1); }
  139. _AFXWIN_INLINE CRect::operator LPRECT()
  140. { return this; }
  141. _AFXWIN_INLINE CRect::operator LPCRECT() const
  142. { return this; }
  143. _AFXWIN_INLINE BOOL CRect::IsRectEmpty() const
  144. { return ::IsRectEmpty(this); }
  145. _AFXWIN_INLINE BOOL CRect::IsRectNull() const
  146. { return (left == 0 && right == 0 && top == 0 && bottom == 0); }
  147. _AFXWIN_INLINE BOOL CRect::PtInRect(POINT point) const
  148. { return ::PtInRect(this, point); }
  149. _AFXWIN_INLINE void CRect::SetRect(int x1, int y1, int x2, int y2)
  150. { ::SetRect(this, x1, y1, x2, y2); }
  151. _AFXWIN_INLINE void CRect::SetRectEmpty()
  152. { ::SetRectEmpty(this); }
  153. _AFXWIN_INLINE void CRect::CopyRect(LPCRECT lpSrcRect)
  154. { ::CopyRect(this, lpSrcRect); }
  155. _AFXWIN_INLINE BOOL CRect::EqualRect(LPCRECT lpRect) const
  156. { return ::EqualRect(this, lpRect); }
  157. _AFXWIN_INLINE void CRect::InflateRect(int x, int y)
  158. { ::InflateRect(this, x, y); }
  159. _AFXWIN_INLINE void CRect::InflateRect(SIZE size)
  160. { ::InflateRect(this, size.cx, size.cy); }
  161. _AFXWIN_INLINE void CRect::OffsetRect(int x, int y)
  162. { ::OffsetRect(this, x, y); }
  163. _AFXWIN_INLINE void CRect::OffsetRect(POINT point)
  164. { ::OffsetRect(this, point.x, point.y); }
  165. _AFXWIN_INLINE void CRect::OffsetRect(SIZE size)
  166. { ::OffsetRect(this, size.cx, size.cy); }
  167. _AFXWIN_INLINE BOOL CRect::IntersectRect(LPCRECT lpRect1, LPCRECT lpRect2)
  168. { return ::IntersectRect(this, lpRect1, lpRect2);}
  169. _AFXWIN_INLINE BOOL CRect::UnionRect(LPCRECT lpRect1, LPCRECT lpRect2)
  170. { return ::UnionRect(this, lpRect1, lpRect2); }
  171. _AFXWIN_INLINE void CRect::operator=(const RECT& srcRect)
  172. { ::CopyRect(this, &srcRect); }
  173. _AFXWIN_INLINE BOOL CRect::operator==(const RECT& rect) const
  174. { return ::EqualRect(this, &rect); }
  175. _AFXWIN_INLINE BOOL CRect::operator!=(const RECT& rect) const
  176. { return !::EqualRect(this, &rect); }
  177. _AFXWIN_INLINE void CRect::operator+=(POINT point)
  178. { ::OffsetRect(this, point.x, point.y); }
  179. _AFXWIN_INLINE void CRect::operator-=(POINT point)
  180. { ::OffsetRect(this, -point.x, -point.y); }
  181. _AFXWIN_INLINE void CRect::operator&=(const RECT& rect)
  182. { ::IntersectRect(this, this, &rect); }
  183. _AFXWIN_INLINE void CRect::operator|=(const RECT& rect)
  184. { ::UnionRect(this, this, &rect); }
  185. _AFXWIN_INLINE CRect CRect::operator+(POINT pt) const
  186. { CRect rect(*this); ::OffsetRect(&rect, pt.x, pt.y); return rect; }
  187. _AFXWIN_INLINE CRect CRect::operator-(POINT pt) const
  188. { CRect rect(*this); ::OffsetRect(&rect, -pt.x, -pt.y); return rect; }
  189. _AFXWIN_INLINE CRect CRect::operator&(const RECT& rect2) const
  190. { CRect rect; ::IntersectRect(&rect, this, &rect2);
  191. return rect; }
  192. _AFXWIN_INLINE CRect CRect::operator|(const RECT& rect2) const
  193. { CRect rect; ::UnionRect(&rect, this, &rect2);
  194. return rect; }
  195. #if (WINVER >= 0x030a)
  196. _AFXWIN_INLINE BOOL CRect::SubtractRect(LPCRECT lpRectSrc1, LPCRECT lpRectSrc2)
  197. { return ::SubtractRect(this, lpRectSrc1, lpRectSrc2); }
  198. #endif // WINVER >= 0x030a
  199. // CArchive output helpers
  200. _AFXWIN_INLINE CArchive& AFXAPI operator<<(CArchive& ar, SIZE size)
  201. { ar.Write(&size, sizeof(SIZE));
  202. return ar; }
  203. _AFXWIN_INLINE CArchive& AFXAPI operator<<(CArchive& ar, POINT point)
  204. { ar.Write(&point, sizeof(POINT));
  205. return ar; }
  206. _AFXWIN_INLINE CArchive& AFXAPI operator<<(CArchive& ar, const RECT& rect)
  207. { ar.Write(&rect, sizeof(RECT));
  208. return ar; }
  209. _AFXWIN_INLINE CArchive& AFXAPI operator>>(CArchive& ar, SIZE& size)
  210. { ar.Read(&size, sizeof(SIZE));
  211. return ar; }
  212. _AFXWIN_INLINE CArchive& AFXAPI operator>>(CArchive& ar, POINT& point)
  213. { ar.Read(&point, sizeof(POINT));
  214. return ar; }
  215. _AFXWIN_INLINE CArchive& AFXAPI operator>>(CArchive& ar, RECT& rect)
  216. { ar.Read(&rect, sizeof(RECT));
  217. return ar; }
  218. // exception support
  219. _AFXWIN_INLINE CResourceException::CResourceException()
  220. { }
  221. _AFXWIN_INLINE CUserException::CUserException()
  222. { }
  223. // CString support (windows specific)
  224. _AFXWIN_INLINE int CString::Compare(const char* psz) const
  225. { return lstrcmp(m_pchData, psz); }
  226. _AFXWIN_INLINE int CString::CompareNoCase(const char* psz) const
  227. { return lstrcmpi(m_pchData, psz); }
  228. _AFXWIN_INLINE int CString::Collate(const char* psz) const
  229. { return lstrcmp(m_pchData, psz); } // lstrcmp does correct sort order
  230. _AFXWIN_INLINE void CString::MakeUpper()
  231. { ::AnsiUpper(m_pchData); }
  232. _AFXWIN_INLINE void CString::MakeLower()
  233. { ::AnsiLower(m_pchData); }
  234. // CGdiObject
  235. _AFXWIN_INLINE HGDIOBJ CGdiObject::GetSafeHandle() const
  236. { return this == NULL ? NULL : m_hObject; }
  237. _AFXWIN_INLINE CGdiObject::CGdiObject()
  238. { m_hObject = NULL; }
  239. _AFXWIN_INLINE int CGdiObject::GetObject(int nCount, LPVOID lpObject) const
  240. { return ::GetObject(m_hObject, nCount, lpObject); }
  241. _AFXWIN_INLINE BOOL CGdiObject::CreateStockObject(int nIndex)
  242. { return (m_hObject = ::GetStockObject(nIndex)) != NULL; }
  243. _AFXWIN_INLINE BOOL CGdiObject::UnrealizeObject()
  244. { return ::UnrealizeObject(m_hObject); }
  245. // CPen
  246. _AFXWIN_INLINE CPen* PASCAL CPen::FromHandle(HPEN hPen)
  247. { return (CPen*) CGdiObject::FromHandle(hPen); }
  248. _AFXWIN_INLINE CPen::CPen()
  249. { }
  250. _AFXWIN_INLINE BOOL CPen::CreatePen(int nPenStyle, int nWidth, COLORREF crColor)
  251. { return Attach(::CreatePen(nPenStyle, nWidth, crColor)); }
  252. _AFXWIN_INLINE BOOL CPen::CreatePenIndirect(LPLOGPEN lpLogPen)
  253. { return Attach(::CreatePenIndirect(lpLogPen)); }
  254. // CBrush
  255. _AFXWIN_INLINE CBrush* PASCAL CBrush::FromHandle(HBRUSH hBrush)
  256. { return (CBrush*) CGdiObject::FromHandle(hBrush); }
  257. _AFXWIN_INLINE CBrush::CBrush()
  258. { }
  259. _AFXWIN_INLINE BOOL CBrush::CreateSolidBrush(COLORREF crColor)
  260. { return Attach(::CreateSolidBrush(crColor)); }
  261. _AFXWIN_INLINE BOOL CBrush::CreateHatchBrush(int nIndex, COLORREF crColor)
  262. { return Attach(::CreateHatchBrush(nIndex, crColor)); }
  263. _AFXWIN_INLINE BOOL CBrush::CreateBrushIndirect(LPLOGBRUSH lpLogBrush)
  264. { return Attach(::CreateBrushIndirect(lpLogBrush)); }
  265. _AFXWIN_INLINE BOOL CBrush::CreateDIBPatternBrush(HGLOBAL hPackedDIB, UINT nUsage)
  266. { return Attach(::CreateDIBPatternBrush(hPackedDIB, nUsage)); }
  267. _AFXWIN_INLINE BOOL CBrush::CreatePatternBrush(CBitmap* pBitmap)
  268. { return Attach(::CreatePatternBrush((HBITMAP)pBitmap->GetSafeHandle())); }
  269. // CFont
  270. _AFXWIN_INLINE CFont* PASCAL CFont::FromHandle(HFONT hFont)
  271. { return (CFont*) CGdiObject::FromHandle(hFont); }
  272. _AFXWIN_INLINE CFont::CFont()
  273. { }
  274. _AFXWIN_INLINE BOOL CFont::CreateFontIndirect(const LOGFONT FAR* lpLogFont)
  275. { return Attach(::CreateFontIndirect(lpLogFont)); }
  276. _AFXWIN_INLINE BOOL CFont::CreateFont(int nHeight, int nWidth, int nEscapement,
  277. int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline,
  278. BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision,
  279. BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily,
  280. LPCSTR lpszFacename)
  281. { return Attach(::CreateFont(nHeight, nWidth, nEscapement,
  282. nOrientation, nWeight, bItalic, bUnderline, cStrikeOut,
  283. nCharSet, nOutPrecision, nClipPrecision, nQuality,
  284. nPitchAndFamily, lpszFacename)); }
  285. // CBitmap
  286. _AFXWIN_INLINE CBitmap* PASCAL CBitmap::FromHandle(HBITMAP hBitmap)
  287. { return (CBitmap*) CGdiObject::FromHandle(hBitmap); }
  288. _AFXWIN_INLINE CBitmap::CBitmap()
  289. { }
  290. _AFXWIN_INLINE BOOL CBitmap::CreateBitmap(int nWidth, int nHeight, UINT nPlanes,
  291. UINT nBitcount, const void FAR* lpBits)
  292. { return Attach(::CreateBitmap(nWidth, nHeight, nPlanes, nBitcount, lpBits)); }
  293. _AFXWIN_INLINE BOOL CBitmap::CreateBitmapIndirect(LPBITMAP lpBitmap)
  294. { return Attach(::CreateBitmapIndirect(lpBitmap)); }
  295. _AFXWIN_INLINE DWORD CBitmap::SetBitmapBits(DWORD dwCount, const void FAR* lpBits)
  296. { return ::SetBitmapBits((HBITMAP)m_hObject, dwCount, lpBits); }
  297. _AFXWIN_INLINE DWORD CBitmap::GetBitmapBits(DWORD dwCount, LPVOID lpBits) const
  298. { return ::GetBitmapBits((HBITMAP)m_hObject, dwCount, lpBits); }
  299. _AFXWIN_INLINE BOOL CBitmap::LoadBitmap(LPCSTR lpszResourceName)
  300. { return Attach(::LoadBitmap(AfxGetResourceHandle(), lpszResourceName));}
  301. _AFXWIN_INLINE CSize CBitmap::SetBitmapDimension(int nWidth, int nHeight)
  302. { return ::SetBitmapDimension((HBITMAP)m_hObject, nWidth, nHeight); }
  303. _AFXWIN_INLINE CSize CBitmap::GetBitmapDimension() const
  304. { return ::GetBitmapDimension((HBITMAP)m_hObject); }
  305. _AFXWIN_INLINE BOOL CBitmap::LoadBitmap(UINT nIDResource)
  306. { return Attach(::LoadBitmap(AfxGetResourceHandle(),
  307. MAKEINTRESOURCE(nIDResource))); }
  308. _AFXWIN_INLINE BOOL CBitmap::LoadOEMBitmap(UINT nIDBitmap)
  309. { return Attach(::LoadBitmap(NULL, MAKEINTRESOURCE(nIDBitmap))); }
  310. _AFXWIN_INLINE BOOL CBitmap::CreateCompatibleBitmap(CDC* pDC, int nWidth, int nHeight)
  311. { return Attach(::CreateCompatibleBitmap(pDC->m_hDC, nWidth, nHeight)); }
  312. _AFXWIN_INLINE BOOL CBitmap::CreateDiscardableBitmap(CDC* pDC, int nWidth, int nHeight)
  313. { return Attach(::CreateDiscardableBitmap(pDC->m_hDC, nWidth, nHeight)); }
  314. // CPalette
  315. _AFXWIN_INLINE CPalette* PASCAL CPalette::FromHandle(HPALETTE hPalette)
  316. { return (CPalette*) CGdiObject::FromHandle(hPalette); }
  317. _AFXWIN_INLINE CPalette::CPalette()
  318. { }
  319. _AFXWIN_INLINE BOOL CPalette::CreatePalette(LPLOGPALETTE lpLogPalette)
  320. { return Attach(::CreatePalette(lpLogPalette)); }
  321. _AFXWIN_INLINE UINT CPalette::GetPaletteEntries(UINT nStartIndex, UINT nNumEntries,
  322. LPPALETTEENTRY lpPaletteColors) const
  323. { return ::GetPaletteEntries((HPALETTE)m_hObject, nStartIndex,
  324. nNumEntries, lpPaletteColors); }
  325. _AFXWIN_INLINE UINT CPalette::SetPaletteEntries(UINT nStartIndex, UINT nNumEntries,
  326. LPPALETTEENTRY lpPaletteColors)
  327. { return ::SetPaletteEntries((HPALETTE)m_hObject, nStartIndex,
  328. nNumEntries, lpPaletteColors); }
  329. _AFXWIN_INLINE void CPalette::AnimatePalette(UINT nStartIndex, UINT nNumEntries,
  330. LPPALETTEENTRY lpPaletteColors)
  331. { ::AnimatePalette((HPALETTE)m_hObject, nStartIndex, nNumEntries,
  332. lpPaletteColors); }
  333. _AFXWIN_INLINE UINT CPalette::GetNearestPaletteIndex(COLORREF crColor) const
  334. { return ::GetNearestPaletteIndex((HPALETTE)m_hObject, crColor); }
  335. _AFXWIN_INLINE BOOL CPalette::ResizePalette(UINT nNumEntries)
  336. { return ::ResizePalette((HPALETTE)m_hObject, nNumEntries); }
  337. // CRgn
  338. _AFXWIN_INLINE CRgn* PASCAL CRgn::FromHandle(HRGN hRgn)
  339. { return (CRgn*) CGdiObject::FromHandle(hRgn); }
  340. _AFXWIN_INLINE CRgn::CRgn()
  341. { }
  342. _AFXWIN_INLINE BOOL CRgn::CreateRectRgn(int x1, int y1, int x2, int y2)
  343. { return Attach(::CreateRectRgn(x1, y1, x2, y2)); }
  344. _AFXWIN_INLINE BOOL CRgn::CreateRectRgnIndirect(LPCRECT lpRect)
  345. { return Attach(::CreateRectRgnIndirect(lpRect)); }
  346. _AFXWIN_INLINE BOOL CRgn::CreateEllipticRgn(int x1, int y1, int x2, int y2)
  347. { return Attach(::CreateEllipticRgn(x1, y1, x2, y2)); }
  348. _AFXWIN_INLINE BOOL CRgn::CreateEllipticRgnIndirect(LPCRECT lpRect)
  349. { return Attach(::CreateEllipticRgnIndirect(lpRect)); }
  350. _AFXWIN_INLINE BOOL CRgn::CreatePolygonRgn(LPPOINT lpPoints, int nCount, int nMode)
  351. { return Attach(::CreatePolygonRgn(lpPoints, nCount, nMode)); }
  352. _AFXWIN_INLINE BOOL CRgn::CreatePolyPolygonRgn(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount, int nPolyFillMode)
  353. { return Attach(::CreatePolyPolygonRgn(lpPoints, lpPolyCounts, nCount, nPolyFillMode)); }
  354. _AFXWIN_INLINE BOOL CRgn::CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3)
  355. { return Attach(::CreateRoundRectRgn(x1, y1, x2, y2, x3, y3)); }
  356. _AFXWIN_INLINE void CRgn::SetRectRgn(int x1, int y1, int x2, int y2)
  357. { ::SetRectRgn((HRGN)m_hObject, x1, y1, x2, y2); }
  358. _AFXWIN_INLINE void CRgn::SetRectRgn(LPCRECT lpRect)
  359. { ::SetRectRgn((HRGN)m_hObject, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); }
  360. _AFXWIN_INLINE int CRgn::CombineRgn(CRgn* pRgn1, CRgn* pRgn2, int nCombineMode)
  361. { return ::CombineRgn((HRGN)m_hObject, (HRGN)pRgn1->GetSafeHandle(),
  362. (HRGN)pRgn2->GetSafeHandle(), nCombineMode); }
  363. _AFXWIN_INLINE int CRgn::CopyRgn(CRgn* pRgnSrc)
  364. { return ::CombineRgn((HRGN)m_hObject, (HRGN)pRgnSrc->GetSafeHandle(), NULL, RGN_COPY); }
  365. _AFXWIN_INLINE BOOL CRgn::EqualRgn(CRgn* pRgn) const
  366. { return ::EqualRgn((HRGN)m_hObject, (HRGN)pRgn->GetSafeHandle()); }
  367. _AFXWIN_INLINE int CRgn::OffsetRgn(int x, int y)
  368. { return ::OffsetRgn((HRGN)m_hObject, x, y); }
  369. _AFXWIN_INLINE int CRgn::OffsetRgn(POINT point)
  370. { return ::OffsetRgn((HRGN)m_hObject, point.x, point.y); }
  371. _AFXWIN_INLINE int CRgn::GetRgnBox(LPRECT lpRect) const
  372. { return ::GetRgnBox((HRGN)m_hObject, lpRect); }
  373. _AFXWIN_INLINE BOOL CRgn::PtInRegion(int x, int y) const
  374. { return ::PtInRegion((HRGN)m_hObject, x, y); }
  375. _AFXWIN_INLINE BOOL CRgn::PtInRegion(POINT point) const
  376. { return ::PtInRegion((HRGN)m_hObject, point.x, point.y); }
  377. _AFXWIN_INLINE BOOL CRgn::RectInRegion(LPCRECT lpRect) const
  378. { return ::RectInRegion((HRGN)m_hObject, lpRect); }
  379. // CDC
  380. _AFXWIN_INLINE HDC CDC::GetSafeHdc() const
  381. { return this == NULL ? NULL : m_hDC; }
  382. _AFXWIN_INLINE BOOL CDC::IsPrinting() const
  383. { return m_bPrinting; }
  384. _AFXWIN_INLINE BOOL CDC::CreateDC(LPCSTR lpszDriverName,
  385. LPCSTR lpszDeviceName, LPCSTR lpszOutput,
  386. const void FAR* lpInitData)
  387. { return Attach(::CreateDC(lpszDriverName,
  388. lpszDeviceName, lpszOutput,
  389. lpInitData)); }
  390. _AFXWIN_INLINE BOOL CDC::CreateIC(LPCSTR lpszDriverName,
  391. LPCSTR lpszDeviceName, LPCSTR lpszOutput,
  392. const void FAR* lpInitData)
  393. { return Attach(::CreateIC(lpszDriverName,
  394. lpszDeviceName, lpszOutput,
  395. lpInitData)); }
  396. _AFXWIN_INLINE BOOL CDC::CreateCompatibleDC(CDC* pDC)
  397. { return Attach(::CreateCompatibleDC(pDC->GetSafeHdc())); }
  398. _AFXWIN_INLINE int CDC::ExcludeUpdateRgn(CWnd* pWnd)
  399. { return ::ExcludeUpdateRgn(m_hDC, pWnd->m_hWnd); }
  400. _AFXWIN_INLINE int CDC::GetDeviceCaps(int nIndex) const
  401. { return ::GetDeviceCaps(m_hAttribDC, nIndex); }
  402. _AFXWIN_INLINE CPoint CDC::GetBrushOrg() const
  403. { return ::GetBrushOrg(m_hDC); }
  404. _AFXWIN_INLINE CPoint CDC::SetBrushOrg(int x, int y)
  405. { return ::SetBrushOrg(m_hDC, x, y); }
  406. _AFXWIN_INLINE CPoint CDC::SetBrushOrg(POINT point)
  407. { return ::SetBrushOrg(m_hDC, point.x, point.y); }
  408. _AFXWIN_INLINE int CDC::EnumObjects(int nObjectType,
  409. int (CALLBACK EXPORT* lpfn)(LPVOID, LPARAM), LPARAM lpData)
  410. #ifdef STRICT
  411. { return ::EnumObjects(m_hAttribDC, nObjectType, (GOBJENUMPROC)lpfn, lpData); }
  412. #else
  413. { return ::EnumObjects(m_hAttribDC, nObjectType, (GOBJENUMPROC)lpfn, (LPSTR)lpData); }
  414. #endif
  415. _AFXWIN_INLINE CBitmap* CDC::SelectObject(CBitmap* pBitmap)
  416. { return (CBitmap*) SelectGdiObject(m_hDC, pBitmap->GetSafeHandle());}
  417. _AFXWIN_INLINE HGDIOBJ CDC::SelectObject(HGDIOBJ hObject) // Safe for NULL handles
  418. { ASSERT(m_hDC == m_hAttribDC); // ASSERT a simple CDC object
  419. return (hObject != NULL) ? ::SelectObject(m_hDC, hObject) : NULL; }
  420. _AFXWIN_INLINE COLORREF CDC::GetNearestColor(COLORREF crColor) const
  421. { return ::GetNearestColor(m_hAttribDC, crColor); }
  422. _AFXWIN_INLINE UINT CDC::RealizePalette()
  423. { return ::RealizePalette(m_hDC); }
  424. _AFXWIN_INLINE void CDC::UpdateColors()
  425. { ::UpdateColors(m_hDC); }
  426. _AFXWIN_INLINE COLORREF CDC::GetBkColor() const
  427. { return ::GetBkColor(m_hAttribDC); }
  428. _AFXWIN_INLINE int CDC::GetBkMode() const
  429. { return ::GetBkMode(m_hAttribDC); }
  430. _AFXWIN_INLINE int CDC::GetPolyFillMode() const
  431. { return ::GetPolyFillMode(m_hAttribDC); }
  432. _AFXWIN_INLINE int CDC::GetROP2() const
  433. { return ::GetROP2(m_hAttribDC); }
  434. _AFXWIN_INLINE int CDC::GetStretchBltMode() const
  435. { return ::GetStretchBltMode(m_hAttribDC); }
  436. _AFXWIN_INLINE COLORREF CDC::GetTextColor() const
  437. { return ::GetTextColor(m_hAttribDC); }
  438. _AFXWIN_INLINE int CDC::GetMapMode() const
  439. { return ::GetMapMode(m_hAttribDC); }
  440. _AFXWIN_INLINE CPoint CDC::GetViewportOrg() const
  441. { return ::GetViewportOrg(m_hAttribDC); }
  442. _AFXWIN_INLINE CSize CDC::GetViewportExt() const
  443. { return ::GetViewportExt(m_hAttribDC); }
  444. _AFXWIN_INLINE CPoint CDC::GetWindowOrg() const
  445. { return ::GetWindowOrg(m_hAttribDC); }
  446. _AFXWIN_INLINE CSize CDC::GetWindowExt() const
  447. { return ::GetWindowExt(m_hAttribDC); }
  448. // non-virtual helpers calling virtual mapping functions
  449. _AFXWIN_INLINE CPoint CDC::SetViewportOrg(POINT point)
  450. { return SetViewportOrg(point.x, point.y); }
  451. _AFXWIN_INLINE CSize CDC::SetViewportExt(SIZE size)
  452. { return SetViewportExt(size.cx, size.cy); }
  453. _AFXWIN_INLINE CPoint CDC::SetWindowOrg(POINT point)
  454. { return SetWindowOrg(point.x, point.y); }
  455. _AFXWIN_INLINE CSize CDC::SetWindowExt(SIZE size)
  456. { return SetWindowExt(size.cx, size.cy); }
  457. _AFXWIN_INLINE void CDC::DPtoLP(LPPOINT lpPoints, int nCount /* = 1 */) const
  458. { VERIFY(::DPtoLP(m_hAttribDC, lpPoints, nCount)); }
  459. _AFXWIN_INLINE void CDC::DPtoLP(LPRECT lpRect) const
  460. { VERIFY(::DPtoLP(m_hAttribDC, (LPPOINT)lpRect, 2)); }
  461. _AFXWIN_INLINE void CDC::LPtoDP(LPPOINT lpPoints, int nCount /* = 1 */) const
  462. { VERIFY(::LPtoDP(m_hAttribDC, lpPoints, nCount)); }
  463. _AFXWIN_INLINE void CDC::LPtoDP(LPRECT lpRect) const
  464. { VERIFY(::LPtoDP(m_hAttribDC, (LPPOINT)lpRect, 2)); }
  465. _AFXWIN_INLINE BOOL CDC::FillRgn(CRgn* pRgn, CBrush* pBrush)
  466. { return ::FillRgn(m_hDC, (HRGN)pRgn->GetSafeHandle(), (HBRUSH)pBrush->GetSafeHandle()); }
  467. _AFXWIN_INLINE BOOL CDC::FrameRgn(CRgn* pRgn, CBrush* pBrush, int nWidth, int nHeight)
  468. { return ::FrameRgn(m_hDC, (HRGN)pRgn->GetSafeHandle(), (HBRUSH)pBrush->GetSafeHandle(),
  469. nWidth, nHeight); }
  470. _AFXWIN_INLINE BOOL CDC::InvertRgn(CRgn* pRgn)
  471. { return ::InvertRgn(m_hDC, (HRGN)pRgn->GetSafeHandle()); }
  472. _AFXWIN_INLINE BOOL CDC::PaintRgn(CRgn* pRgn)
  473. { return ::PaintRgn(m_hDC, (HRGN)pRgn->GetSafeHandle()); }
  474. _AFXWIN_INLINE BOOL CDC::PtVisible(int x, int y) const
  475. { return ::PtVisible(m_hDC, x, y); }
  476. _AFXWIN_INLINE BOOL CDC::PtVisible(POINT point) const
  477. { return PtVisible(point.x, point.y); } // call virtual
  478. _AFXWIN_INLINE BOOL CDC::RectVisible(LPCRECT lpRect) const
  479. { return ::RectVisible(m_hDC, lpRect); }
  480. _AFXWIN_INLINE CPoint CDC::GetCurrentPosition() const
  481. { return ::GetCurrentPosition(m_hAttribDC); }
  482. _AFXWIN_INLINE CPoint CDC::MoveTo(POINT point)
  483. { return MoveTo(point.x, point.y); }
  484. _AFXWIN_INLINE BOOL CDC::LineTo(POINT point)
  485. { return LineTo(point.x, point.y); }
  486. _AFXWIN_INLINE BOOL CDC::Arc(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
  487. { return ::Arc(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); }
  488. _AFXWIN_INLINE BOOL CDC::Arc(LPCRECT lpRect, POINT ptStart, POINT ptEnd)
  489. { return ::Arc(m_hDC, lpRect->left, lpRect->top,
  490. lpRect->right, lpRect->bottom, ptStart.x, ptStart.y,
  491. ptEnd.x, ptEnd.y); }
  492. _AFXWIN_INLINE BOOL CDC::Polyline(LPPOINT lpPoints, int nCount)
  493. { return ::Polyline(m_hDC, lpPoints, nCount); }
  494. _AFXWIN_INLINE void CDC::FillRect(LPCRECT lpRect, CBrush* pBrush)
  495. { ::FillRect(m_hDC, lpRect, (HBRUSH)pBrush->GetSafeHandle()); }
  496. _AFXWIN_INLINE void CDC::FrameRect(LPCRECT lpRect, CBrush* pBrush)
  497. { ::FrameRect(m_hDC, lpRect, (HBRUSH)pBrush->GetSafeHandle()); }
  498. _AFXWIN_INLINE void CDC::InvertRect(LPCRECT lpRect)
  499. { ::InvertRect(m_hDC, lpRect); }
  500. _AFXWIN_INLINE BOOL CDC::DrawIcon(int x, int y, HICON hIcon)
  501. { return ::DrawIcon(m_hDC, x, y, hIcon); }
  502. _AFXWIN_INLINE BOOL CDC::DrawIcon(POINT point, HICON hIcon)
  503. { return ::DrawIcon(m_hDC, point.x, point.y, hIcon); }
  504. _AFXWIN_INLINE BOOL CDC::Chord(int x1, int y1, int x2, int y2, int x3, int y3,
  505. int x4, int y4)
  506. { return ::Chord(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); }
  507. _AFXWIN_INLINE BOOL CDC::Chord(LPCRECT lpRect, POINT ptStart, POINT ptEnd)
  508. { return ::Chord(m_hDC, lpRect->left, lpRect->top,
  509. lpRect->right, lpRect->bottom, ptStart.x, ptStart.y,
  510. ptEnd.x, ptEnd.y); }
  511. _AFXWIN_INLINE void CDC::DrawFocusRect(LPCRECT lpRect)
  512. { ::DrawFocusRect(m_hDC, lpRect); }
  513. _AFXWIN_INLINE BOOL CDC::Ellipse(int x1, int y1, int x2, int y2)
  514. { return ::Ellipse(m_hDC, x1, y1, x2, y2); }
  515. _AFXWIN_INLINE BOOL CDC::Ellipse(LPCRECT lpRect)
  516. { return ::Ellipse(m_hDC, lpRect->left, lpRect->top,
  517. lpRect->right, lpRect->bottom); }
  518. _AFXWIN_INLINE BOOL CDC::Pie(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
  519. { return ::Pie(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); }
  520. _AFXWIN_INLINE BOOL CDC::Pie(LPCRECT lpRect, POINT ptStart, POINT ptEnd)
  521. { return ::Pie(m_hDC, lpRect->left, lpRect->top,
  522. lpRect->right, lpRect->bottom, ptStart.x, ptStart.y,
  523. ptEnd.x, ptEnd.y); }
  524. _AFXWIN_INLINE BOOL CDC::Polygon(LPPOINT lpPoints, int nCount)
  525. { return ::Polygon(m_hDC, lpPoints, nCount); }
  526. _AFXWIN_INLINE BOOL CDC::PolyPolygon(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount)
  527. { return ::PolyPolygon(m_hDC, lpPoints, lpPolyCounts, nCount); }
  528. _AFXWIN_INLINE BOOL CDC::Rectangle(int x1, int y1, int x2, int y2)
  529. { return ::Rectangle(m_hDC, x1, y1, x2, y2); }
  530. _AFXWIN_INLINE BOOL CDC::Rectangle(LPCRECT lpRect)
  531. { return ::Rectangle(m_hDC, lpRect->left, lpRect->top,
  532. lpRect->right, lpRect->bottom); }
  533. _AFXWIN_INLINE BOOL CDC::RoundRect(int x1, int y1, int x2, int y2, int x3, int y3)
  534. { return ::RoundRect(m_hDC, x1, y1, x2, y2, x3, y3); }
  535. _AFXWIN_INLINE BOOL CDC::RoundRect(LPCRECT lpRect, POINT point)
  536. { return ::RoundRect(m_hDC, lpRect->left, lpRect->top,
  537. lpRect->right, lpRect->bottom, point.x, point.y); }
  538. _AFXWIN_INLINE BOOL CDC::PatBlt(int x, int y, int nWidth, int nHeight, DWORD dwRop)
  539. { return ::PatBlt(m_hDC, x, y, nWidth, nHeight, dwRop); }
  540. _AFXWIN_INLINE BOOL CDC::BitBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC,
  541. int xSrc, int ySrc, DWORD dwRop)
  542. { return ::BitBlt(m_hDC, x, y, nWidth, nHeight,
  543. pSrcDC->GetSafeHdc(), xSrc, ySrc, dwRop); }
  544. _AFXWIN_INLINE BOOL CDC::StretchBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC,
  545. int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop)
  546. { return ::StretchBlt(m_hDC, x, y, nWidth, nHeight,
  547. pSrcDC->GetSafeHdc(), xSrc, ySrc, nSrcWidth, nSrcHeight,
  548. dwRop); }
  549. _AFXWIN_INLINE COLORREF CDC::GetPixel(int x, int y) const
  550. { return ::GetPixel(m_hDC, x, y); }
  551. _AFXWIN_INLINE COLORREF CDC::GetPixel(POINT point) const
  552. { return ::GetPixel(m_hDC, point.x, point.y); }
  553. _AFXWIN_INLINE COLORREF CDC::SetPixel(int x, int y, COLORREF crColor)
  554. { return ::SetPixel(m_hDC, x, y, crColor); }
  555. _AFXWIN_INLINE COLORREF CDC::SetPixel(POINT point, COLORREF crColor)
  556. { return ::SetPixel(m_hDC, point.x, point.y, crColor); }
  557. _AFXWIN_INLINE BOOL CDC::FloodFill(int x, int y, COLORREF crColor)
  558. { return ::FloodFill(m_hDC, x, y, crColor); }
  559. _AFXWIN_INLINE BOOL CDC::ExtFloodFill(int x, int y, COLORREF crColor, UINT nFillType)
  560. { return ::ExtFloodFill(m_hDC, x, y, crColor, nFillType); }
  561. _AFXWIN_INLINE BOOL CDC::TextOut(int x, int y, LPCSTR lpszString, int nCount)
  562. { return ::TextOut(m_hDC, x, y, lpszString, nCount); }
  563. _AFXWIN_INLINE BOOL CDC::TextOut(int x, int y, const CString& str)
  564. { return TextOut(x, y, (const char*)str, str.GetLength()); } // call virtual
  565. _AFXWIN_INLINE BOOL CDC::ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect,
  566. LPCSTR lpszString, UINT nCount, LPINT lpDxWidths)
  567. { return ::ExtTextOut(m_hDC, x, y, nOptions, lpRect,
  568. lpszString, nCount, lpDxWidths); }
  569. _AFXWIN_INLINE CSize CDC::TabbedTextOut(int x, int y, LPCSTR lpszString, int nCount,
  570. int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin)
  571. { return ::TabbedTextOut(m_hDC, x, y, lpszString, nCount,
  572. nTabPositions, lpnTabStopPositions, nTabOrigin); }
  573. _AFXWIN_INLINE int CDC::DrawText(LPCSTR lpszString, int nCount, LPRECT lpRect,
  574. UINT nFormat)
  575. { return ::DrawText(m_hDC, lpszString, nCount, lpRect, nFormat); }
  576. _AFXWIN_INLINE CSize CDC::GetTextExtent(LPCSTR lpszString, int nCount) const
  577. { return ::GetTextExtent(m_hAttribDC, lpszString, nCount); }
  578. _AFXWIN_INLINE CSize CDC::GetOutputTextExtent(LPCSTR lpszString, int nCount) const
  579. { return ::GetTextExtent(m_hDC, lpszString, nCount); }
  580. _AFXWIN_INLINE CSize CDC::GetTabbedTextExtent(LPCSTR lpszString, int nCount,
  581. int nTabPositions, LPINT lpnTabStopPositions) const
  582. { return ::GetTabbedTextExtent(m_hAttribDC, lpszString, nCount,
  583. nTabPositions, lpnTabStopPositions); }
  584. _AFXWIN_INLINE CSize CDC::GetOutputTabbedTextExtent(LPCSTR lpszString, int nCount,
  585. int nTabPositions, LPINT lpnTabStopPositions) const
  586. { return ::GetTabbedTextExtent(m_hDC, lpszString, nCount,
  587. nTabPositions, lpnTabStopPositions); }
  588. _AFXWIN_INLINE BOOL CDC::GrayString(CBrush* pBrush,
  589. BOOL (CALLBACK EXPORT* lpfnOutput)(HDC, LPARAM, int),
  590. LPARAM lpData, int nCount,
  591. int x, int y, int nWidth, int nHeight)
  592. { return ::GrayString(m_hDC, (HBRUSH)pBrush->GetSafeHandle(),
  593. (GRAYSTRINGPROC)lpfnOutput, lpData, nCount, x, y, nWidth, nHeight); }
  594. _AFXWIN_INLINE UINT CDC::GetTextAlign() const
  595. { return ::GetTextAlign(m_hAttribDC); }
  596. _AFXWIN_INLINE int CDC::GetTextFace(int nCount, LPSTR lpszFacename) const
  597. { return ::GetTextFace(m_hAttribDC, nCount, lpszFacename); }
  598. _AFXWIN_INLINE BOOL CDC::GetTextMetrics(LPTEXTMETRIC lpMetrics) const
  599. { return ::GetTextMetrics(m_hAttribDC, lpMetrics); }
  600. _AFXWIN_INLINE BOOL CDC::GetOutputTextMetrics(LPTEXTMETRIC lpMetrics) const
  601. { return ::GetTextMetrics(m_hDC, lpMetrics); }
  602. _AFXWIN_INLINE int CDC::GetTextCharacterExtra() const
  603. { return ::GetTextCharacterExtra(m_hAttribDC); }
  604. _AFXWIN_INLINE BOOL CDC::GetCharWidth(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const
  605. { return ::GetCharWidth(m_hAttribDC, nFirstChar, nLastChar, lpBuffer); }
  606. _AFXWIN_INLINE BOOL CDC::GetOutputCharWidth(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const
  607. { return ::GetCharWidth(m_hDC, nFirstChar, nLastChar, lpBuffer); }
  608. _AFXWIN_INLINE CSize CDC::GetAspectRatioFilter() const
  609. { return ::GetAspectRatioFilter(m_hAttribDC); }
  610. _AFXWIN_INLINE BOOL CDC::ScrollDC(int dx, int dy,
  611. LPCRECT lpRectScroll, LPCRECT lpRectClip,
  612. CRgn* pRgnUpdate, LPRECT lpRectUpdate)
  613. { return ::ScrollDC(m_hDC, dx, dy, lpRectScroll,
  614. lpRectClip, (HRGN)pRgnUpdate->GetSafeHandle(), lpRectUpdate); }
  615. _AFXWIN_INLINE BOOL CDC::PlayMetaFile(HMETAFILE hMF)
  616. { return ::PlayMetaFile(m_hDC, hMF); }
  617. // Printer Escape Functions
  618. _AFXWIN_INLINE int CDC::Escape(int nEscape, int nCount, LPCSTR lpszInData, LPVOID lpOutData)
  619. { return ::Escape(m_hDC, nEscape, nCount, lpszInData, lpOutData);}
  620. // CDC 3.1 Specific functions
  621. #if (WINVER >= 0x030a)
  622. _AFXWIN_INLINE BOOL CDC::QueryAbort() const
  623. { return ::QueryAbort(m_hDC, 0); }
  624. _AFXWIN_INLINE UINT CDC::SetBoundsRect(LPCRECT lpRectBounds, UINT flags)
  625. { return ::SetBoundsRect(m_hDC, lpRectBounds, flags); }
  626. _AFXWIN_INLINE UINT CDC::GetBoundsRect(LPRECT lpRectBounds, UINT flags)
  627. { return ::GetBoundsRect(m_hAttribDC, lpRectBounds, flags); }
  628. _AFXWIN_INLINE BOOL CDC::ResetDC(const DEVMODE FAR* lpDevMode)
  629. { return ::ResetDC(m_hAttribDC, lpDevMode) != NULL; }
  630. _AFXWIN_INLINE UINT CDC::GetOutlineTextMetrics(UINT cbData, LPOUTLINETEXTMETRIC lpotm) const
  631. { return ::GetOutlineTextMetrics(m_hAttribDC, cbData, lpotm); }
  632. _AFXWIN_INLINE BOOL CDC::GetCharABCWidths(UINT nFirst, UINT nLast, LPABC lpabc) const
  633. { return ::GetCharABCWidths(m_hAttribDC, nFirst, nLast, lpabc); }
  634. _AFXWIN_INLINE DWORD CDC::GetFontData(DWORD dwTable, DWORD dwOffset, LPVOID lpData,
  635. DWORD cbData) const
  636. { return ::GetFontData(m_hAttribDC, dwTable, dwOffset, lpData, cbData); }
  637. _AFXWIN_INLINE int CDC::GetKerningPairs(int nPairs, LPKERNINGPAIR lpkrnpair) const
  638. { return ::GetKerningPairs(m_hAttribDC, nPairs, lpkrnpair); }
  639. _AFXWIN_INLINE DWORD CDC::GetGlyphOutline(UINT nChar, UINT nFormat, LPGLYPHMETRICS lpgm,
  640. DWORD cbBuffer, LPVOID lpBuffer, const MAT2 FAR* lpmat2) const
  641. { return ::GetGlyphOutline(m_hAttribDC, nChar, nFormat,
  642. lpgm, cbBuffer, lpBuffer, lpmat2); }
  643. #endif // WINVER >= 0x030a
  644. // CMenu
  645. _AFXWIN_INLINE CMenu::CMenu()
  646. { m_hMenu = NULL; }
  647. _AFXWIN_INLINE BOOL CMenu::CreateMenu()
  648. { return Attach(::CreateMenu()); }
  649. _AFXWIN_INLINE BOOL CMenu::CreatePopupMenu()
  650. { return Attach(::CreatePopupMenu()); }
  651. _AFXWIN_INLINE HMENU CMenu::GetSafeHmenu() const
  652. { return this == NULL ? NULL : m_hMenu; }
  653. _AFXWIN_INLINE BOOL CMenu::DeleteMenu(UINT nPosition, UINT nFlags)
  654. { return ::DeleteMenu(m_hMenu, nPosition, nFlags); }
  655. _AFXWIN_INLINE BOOL CMenu::AppendMenu(UINT nFlags, UINT nIDNewItem /* = 0 */, LPCSTR lpszNewItem /* = NULL */)
  656. { return ::AppendMenu(m_hMenu, nFlags, nIDNewItem, lpszNewItem); }
  657. _AFXWIN_INLINE BOOL CMenu::AppendMenu(UINT nFlags, UINT nIDNewItem, const CBitmap* pBmp)
  658. { return ::AppendMenu(m_hMenu, nFlags | MF_BITMAP, nIDNewItem,
  659. MAKEINTRESOURCE(pBmp->GetSafeHandle())); }
  660. _AFXWIN_INLINE UINT CMenu::CheckMenuItem(UINT nIDCheckItem, UINT nCheck)
  661. { return ::CheckMenuItem(m_hMenu, nIDCheckItem, nCheck); }
  662. _AFXWIN_INLINE UINT CMenu::EnableMenuItem(UINT nIDEnableItem, UINT nEnable)
  663. { return ::EnableMenuItem(m_hMenu, nIDEnableItem, nEnable); }
  664. _AFXWIN_INLINE UINT CMenu::GetMenuItemCount() const
  665. { return ::GetMenuItemCount(m_hMenu); }
  666. _AFXWIN_INLINE UINT CMenu::GetMenuItemID(int nPos) const
  667. { return ::GetMenuItemID(m_hMenu, nPos); }
  668. _AFXWIN_INLINE UINT CMenu::GetMenuState(UINT nID, UINT nFlags) const
  669. { return ::GetMenuState(m_hMenu, nID, nFlags); }
  670. _AFXWIN_INLINE int CMenu::GetMenuString(UINT nIDItem, LPSTR lpString, int nMaxCount, UINT nFlags) const
  671. { return ::GetMenuString(m_hMenu, nIDItem, lpString, nMaxCount, nFlags); }
  672. _AFXWIN_INLINE CMenu* CMenu::GetSubMenu(int nPos) const
  673. { return CMenu::FromHandle(::GetSubMenu(m_hMenu, nPos)); }
  674. _AFXWIN_INLINE BOOL CMenu::InsertMenu(UINT nPosition, UINT nFlags, UINT nIDNewItem /* = 0 */,
  675. LPCSTR lpszNewItem /* = NULL */)
  676. { return ::InsertMenu(m_hMenu, nPosition, nFlags, nIDNewItem, lpszNewItem); }
  677. _AFXWIN_INLINE BOOL CMenu::InsertMenu(UINT nPosition, UINT nFlags, UINT nIDNewItem, const CBitmap* pBmp)
  678. { return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_BITMAP, nIDNewItem,
  679. MAKEINTRESOURCE(pBmp->GetSafeHandle())); }
  680. _AFXWIN_INLINE BOOL CMenu::ModifyMenu(UINT nPosition, UINT nFlags, UINT nIDNewItem /* = 0 */, LPCSTR lpszNewItem /* = NULL */)
  681. { return ::ModifyMenu(m_hMenu, nPosition, nFlags, nIDNewItem, lpszNewItem); }
  682. _AFXWIN_INLINE BOOL CMenu::ModifyMenu(UINT nPosition, UINT nFlags, UINT nIDNewItem, const CBitmap* pBmp)
  683. { return ::ModifyMenu(m_hMenu, nPosition, nFlags | MF_BITMAP, nIDNewItem,
  684. MAKEINTRESOURCE(pBmp->GetSafeHandle())); }
  685. _AFXWIN_INLINE BOOL CMenu::RemoveMenu(UINT nPosition, UINT nFlags)
  686. { return ::RemoveMenu(m_hMenu, nPosition, nFlags); }
  687. _AFXWIN_INLINE BOOL CMenu::SetMenuItemBitmaps(UINT nPosition, UINT nFlags,
  688. const CBitmap* pBmpUnchecked, const CBitmap* pBmpChecked)
  689. { return ::SetMenuItemBitmaps(m_hMenu, nPosition, nFlags,
  690. (HBITMAP)pBmpUnchecked->GetSafeHandle(),
  691. (HBITMAP)pBmpChecked->GetSafeHandle()); }
  692. _AFXWIN_INLINE BOOL CMenu::LoadMenu(LPCSTR lpszResourceName)
  693. { return Attach(::LoadMenu(AfxGetResourceHandle(), lpszResourceName)); }
  694. _AFXWIN_INLINE BOOL CMenu::LoadMenu(UINT nIDResource)
  695. { return Attach(::LoadMenu(AfxGetResourceHandle(),
  696. MAKEINTRESOURCE(nIDResource))); }
  697. _AFXWIN_INLINE BOOL CMenu::LoadMenuIndirect(const void FAR* lpMenuTemplate)
  698. { return Attach(::LoadMenuIndirect(lpMenuTemplate)); }
  699. // CCmdUI
  700. _AFXWIN_INLINE void CCmdUI::ContinueRouting()
  701. { m_bContinueRouting = TRUE; }
  702. #endif //_AFXWIN_INLINE