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.

879 lines
43 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 2)
  10. #include <limits.h>
  11. #ifdef _AFXWIN_INLINE
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CWnd
  14. _AFXWIN_INLINE HWND CWnd::GetSafeHwnd() const
  15. { return this == NULL ? NULL : m_hWnd; }
  16. _AFXWIN_INLINE DWORD CWnd::GetStyle() const
  17. { return (DWORD)GetWindowLong(m_hWnd, GWL_STYLE); }
  18. _AFXWIN_INLINE DWORD CWnd::GetExStyle() const
  19. { return (DWORD)GetWindowLong(m_hWnd, GWL_EXSTYLE); }
  20. _AFXWIN_INLINE CWnd* CWnd::GetOwner() const
  21. { return m_hWndOwner != NULL ? CWnd::FromHandle(m_hWndOwner) : GetParent(); }
  22. _AFXWIN_INLINE void CWnd::SetOwner(CWnd* pOwnerWnd)
  23. { m_hWndOwner = pOwnerWnd != NULL ? pOwnerWnd->m_hWnd : NULL; }
  24. _AFXWIN_INLINE LRESULT CWnd::SendMessage(UINT message, WPARAM wParam, LPARAM lParam)
  25. { return ::SendMessage(m_hWnd, message, wParam, lParam); }
  26. _AFXWIN_INLINE BOOL CWnd::PostMessage(UINT message, WPARAM wParam, LPARAM lParam)
  27. { return ::PostMessage(m_hWnd, message, wParam, lParam); }
  28. _AFXWIN_INLINE void CWnd::SetWindowText(LPCSTR lpszString)
  29. { ::SetWindowText(m_hWnd, lpszString); }
  30. _AFXWIN_INLINE int CWnd::GetWindowText(LPSTR lpszString, int nMaxCount) const
  31. { return ::GetWindowText(m_hWnd, lpszString, nMaxCount); }
  32. _AFXWIN_INLINE int CWnd::GetWindowTextLength() const
  33. { return ::GetWindowTextLength(m_hWnd); }
  34. _AFXWIN_INLINE void CWnd::GetWindowText(CString& rString) const
  35. { int nLen = ::GetWindowTextLength(m_hWnd);
  36. ::GetWindowText(m_hWnd, rString.GetBufferSetLength(nLen), nLen+1); }
  37. _AFXWIN_INLINE void CWnd::SetFont(CFont* pFont, BOOL bRedraw /* = TRUE */)
  38. { ::SendMessage(m_hWnd, WM_SETFONT, (WPARAM)pFont->GetSafeHandle(), bRedraw); }
  39. _AFXWIN_INLINE CFont* CWnd::GetFont() const
  40. { return CFont::FromHandle((HFONT)::SendMessage(m_hWnd, WM_GETFONT, 0, 0)); }
  41. _AFXWIN_INLINE CMenu* CWnd::GetMenu() const
  42. { return CMenu::FromHandle(::GetMenu(m_hWnd)); }
  43. _AFXWIN_INLINE BOOL CWnd::SetMenu(CMenu* pMenu)
  44. { return ::SetMenu(m_hWnd, pMenu->GetSafeHmenu()); }
  45. _AFXWIN_INLINE void CWnd::DrawMenuBar()
  46. { ::DrawMenuBar(m_hWnd); }
  47. _AFXWIN_INLINE CMenu* CWnd::GetSystemMenu(BOOL bRevert) const
  48. { return CMenu::FromHandle(::GetSystemMenu(m_hWnd, bRevert)); }
  49. _AFXWIN_INLINE BOOL CWnd::HiliteMenuItem(CMenu* pMenu, UINT nIDHiliteItem, UINT nHilite)
  50. { return ::HiliteMenuItem(m_hWnd, pMenu->m_hMenu, nIDHiliteItem, nHilite); }
  51. _AFXWIN_INLINE int CWnd::GetDlgCtrlID() const
  52. { return ::GetDlgCtrlID(m_hWnd); }
  53. _AFXWIN_INLINE BOOL CWnd::IsIconic() const
  54. { return ::IsIconic(m_hWnd); }
  55. _AFXWIN_INLINE BOOL CWnd::IsZoomed() const
  56. { return ::IsZoomed(m_hWnd); }
  57. _AFXWIN_INLINE void CWnd::MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint /* = TRUE */)
  58. { ::MoveWindow(m_hWnd, x, y, nWidth, nHeight, bRepaint); }
  59. _AFXWIN_INLINE void CWnd::MoveWindow(LPCRECT lpRect, BOOL bRepaint /* = TRUE */)
  60. { ::MoveWindow(m_hWnd, lpRect->left, lpRect->top, lpRect->right - lpRect->left,
  61. lpRect->bottom - lpRect->top, bRepaint); }
  62. _AFXWIN_INLINE BOOL CWnd::SetWindowPos(const CWnd* pWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
  63. #if (WINVER >= 0x030a)
  64. { return ::SetWindowPos(m_hWnd, pWndInsertAfter->GetSafeHwnd(),
  65. x, y, cx, cy, nFlags); }
  66. #else
  67. { ::SetWindowPos(m_hWnd, pWndInsertAfter->GetSafeHwnd(),
  68. x, y, cx, cy, nFlags); return TRUE; }
  69. #endif // WINVER >= 0x030a
  70. _AFXWIN_INLINE UINT CWnd::ArrangeIconicWindows()
  71. { return ::ArrangeIconicWindows(m_hWnd); }
  72. _AFXWIN_INLINE void CWnd::BringWindowToTop()
  73. { ::BringWindowToTop(m_hWnd); }
  74. _AFXWIN_INLINE void CWnd::GetWindowRect(LPRECT lpRect) const
  75. { ::GetWindowRect(m_hWnd, lpRect); }
  76. _AFXWIN_INLINE void CWnd::GetClientRect(LPRECT lpRect) const
  77. { ::GetClientRect(m_hWnd, lpRect); }
  78. #if (WINVER >= 0x030a)
  79. _AFXWIN_INLINE BOOL CWnd::GetWindowPlacement(WINDOWPLACEMENT FAR* lpwndpl) const
  80. { return ::GetWindowPlacement(m_hWnd, lpwndpl); }
  81. _AFXWIN_INLINE BOOL CWnd::SetWindowPlacement(const WINDOWPLACEMENT FAR* lpwndpl)
  82. { return ::SetWindowPlacement(m_hWnd, lpwndpl); }
  83. _AFXWIN_INLINE void CWnd::MapWindowPoints(CWnd* pwndTo, LPPOINT lpPoint, UINT nCount) const
  84. { ::MapWindowPoints(m_hWnd, pwndTo->GetSafeHwnd(), lpPoint, nCount); }
  85. _AFXWIN_INLINE void CWnd::MapWindowPoints(CWnd* pwndTo, LPRECT lpRect) const
  86. { ::MapWindowPoints(m_hWnd, pwndTo->GetSafeHwnd(), (LPPOINT)lpRect, 2); }
  87. #endif // WINVER >= 0x030a
  88. _AFXWIN_INLINE void CWnd::ClientToScreen(LPPOINT lpPoint) const
  89. { ::ClientToScreen(m_hWnd, lpPoint); }
  90. _AFXWIN_INLINE void CWnd::ClientToScreen(LPRECT lpRect) const
  91. { ::ClientToScreen(m_hWnd, (LPPOINT)lpRect);
  92. ::ClientToScreen(m_hWnd, ((LPPOINT)lpRect)+1); }
  93. _AFXWIN_INLINE void CWnd::ScreenToClient(LPPOINT lpPoint) const
  94. { ::ScreenToClient(m_hWnd, lpPoint); }
  95. _AFXWIN_INLINE void CWnd::ScreenToClient(LPRECT lpRect) const
  96. { ::ScreenToClient(m_hWnd, (LPPOINT)lpRect);
  97. ::ScreenToClient(m_hWnd, ((LPPOINT)lpRect)+1); }
  98. _AFXWIN_INLINE CDC* CWnd::BeginPaint(LPPAINTSTRUCT lpPaint)
  99. { return CDC::FromHandle(::BeginPaint(m_hWnd, lpPaint)); }
  100. _AFXWIN_INLINE void CWnd::EndPaint(LPPAINTSTRUCT lpPaint)
  101. { ::EndPaint(m_hWnd, lpPaint); }
  102. _AFXWIN_INLINE CDC* CWnd::GetDC()
  103. { return CDC::FromHandle(::GetDC(m_hWnd)); }
  104. _AFXWIN_INLINE CDC* CWnd::GetWindowDC()
  105. { return CDC::FromHandle(::GetWindowDC(m_hWnd)); }
  106. _AFXWIN_INLINE int CWnd::ReleaseDC(CDC* pDC)
  107. { return ::ReleaseDC(m_hWnd, pDC->m_hDC); }
  108. _AFXWIN_INLINE void CWnd::UpdateWindow()
  109. { ::UpdateWindow(m_hWnd); }
  110. _AFXWIN_INLINE void CWnd::SetRedraw(BOOL bRedraw /* = TRUE */)
  111. { ::SendMessage(m_hWnd, WM_SETREDRAW, bRedraw, 0); }
  112. _AFXWIN_INLINE BOOL CWnd::GetUpdateRect(LPRECT lpRect, BOOL bErase /* = FALSE */)
  113. { return ::GetUpdateRect(m_hWnd, lpRect, bErase); }
  114. _AFXWIN_INLINE int CWnd::GetUpdateRgn(CRgn* pRgn, BOOL bErase /* = FALSE */)
  115. { return ::GetUpdateRgn(m_hWnd, (HRGN)pRgn->GetSafeHandle(), bErase); }
  116. _AFXWIN_INLINE void CWnd::Invalidate(BOOL bErase /* = TRUE */)
  117. { ::InvalidateRect(m_hWnd, NULL, bErase); }
  118. _AFXWIN_INLINE void CWnd::InvalidateRect(LPCRECT lpRect, BOOL bErase)
  119. { ::InvalidateRect(m_hWnd, lpRect, bErase); }
  120. _AFXWIN_INLINE void CWnd::InvalidateRgn(CRgn* pRgn, BOOL bErase /* = TRUE */)
  121. { ::InvalidateRgn(m_hWnd, (HRGN)pRgn->GetSafeHandle(), bErase); }
  122. _AFXWIN_INLINE void CWnd::ValidateRect(LPCRECT lpRect)
  123. { ::ValidateRect(m_hWnd, lpRect); }
  124. _AFXWIN_INLINE void CWnd::ValidateRgn(CRgn* pRgn)
  125. { ::ValidateRgn(m_hWnd, (HRGN)pRgn->GetSafeHandle()); }
  126. _AFXWIN_INLINE BOOL CWnd::ShowWindow(int nCmdShow)
  127. { return ::ShowWindow(m_hWnd, nCmdShow); }
  128. _AFXWIN_INLINE BOOL CWnd::IsWindowVisible() const
  129. { return ::IsWindowVisible(m_hWnd); }
  130. _AFXWIN_INLINE void CWnd::ShowOwnedPopups(BOOL bShow /* = TRUE */)
  131. { ::ShowOwnedPopups(m_hWnd, bShow); }
  132. _AFXWIN_INLINE void CWnd::SendMessageToDescendants(
  133. UINT message, WPARAM wParam, LPARAM lParam, BOOL bDeep, BOOL bOnlyPerm)
  134. { CWnd::SendMessageToDescendants(m_hWnd, message, wParam, lParam, bDeep,
  135. bOnlyPerm); }
  136. _AFXWIN_INLINE CWnd* CWnd::GetDescendantWindow(int nID, BOOL bOnlyPerm) const
  137. { return CWnd::GetDescendantWindow(m_hWnd, nID, bOnlyPerm); }
  138. #if (WINVER >= 0x030a)
  139. _AFXWIN_INLINE CDC* CWnd::GetDCEx(CRgn* prgnClip, DWORD flags)
  140. { return CDC::FromHandle(::GetDCEx(m_hWnd, (HRGN)prgnClip->GetSafeHandle(), flags)); }
  141. _AFXWIN_INLINE BOOL CWnd::LockWindowUpdate()
  142. { return ::LockWindowUpdate(m_hWnd); }
  143. _AFXWIN_INLINE BOOL CWnd::RedrawWindow(LPCRECT lpRectUpdate,
  144. CRgn* prgnUpdate,
  145. UINT flags /* = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE */)
  146. { return ::RedrawWindow(m_hWnd, lpRectUpdate, (HRGN)prgnUpdate->GetSafeHandle(), flags); }
  147. _AFXWIN_INLINE BOOL CWnd::EnableScrollBar(int nSBFlags,
  148. UINT nArrowFlags /* = ESB_ENABLE_BOTH */)
  149. { return (BOOL)::EnableScrollBar(m_hWnd, nSBFlags, nArrowFlags); }
  150. #endif // WINVER >= 0x030a
  151. _AFXWIN_INLINE UINT CWnd::SetTimer(UINT nIDEvent, UINT nElapse,
  152. void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT, UINT, DWORD))
  153. { return ::SetTimer(m_hWnd, nIDEvent, nElapse,
  154. (TIMERPROC)lpfnTimer); }
  155. _AFXWIN_INLINE BOOL CWnd::KillTimer(int nIDEvent)
  156. { return ::KillTimer(m_hWnd, nIDEvent); }
  157. _AFXWIN_INLINE BOOL CWnd::IsWindowEnabled() const
  158. { return ::IsWindowEnabled(m_hWnd); }
  159. _AFXWIN_INLINE BOOL CWnd::EnableWindow(BOOL bEnable /* = TRUE */)
  160. { return ::EnableWindow(m_hWnd, bEnable); }
  161. _AFXWIN_INLINE CWnd* PASCAL CWnd::GetActiveWindow()
  162. { return CWnd::FromHandle(::GetActiveWindow()); }
  163. _AFXWIN_INLINE CWnd* CWnd::SetActiveWindow()
  164. { return CWnd::FromHandle(::SetActiveWindow(m_hWnd)); }
  165. _AFXWIN_INLINE CWnd* PASCAL CWnd::GetCapture()
  166. { return CWnd::FromHandle(::GetCapture()); }
  167. _AFXWIN_INLINE CWnd* CWnd::SetCapture()
  168. { return CWnd::FromHandle(::SetCapture(m_hWnd)); }
  169. _AFXWIN_INLINE CWnd* PASCAL CWnd::GetFocus()
  170. { return CWnd::FromHandle(::GetFocus()); }
  171. _AFXWIN_INLINE CWnd* CWnd::SetFocus()
  172. { return CWnd::FromHandle(::SetFocus(m_hWnd)); }
  173. _AFXWIN_INLINE CWnd* PASCAL CWnd::GetDesktopWindow()
  174. { return CWnd::FromHandle(::GetDesktopWindow()); }
  175. _AFXWIN_INLINE void CWnd::CheckDlgButton(int nIDButton, UINT nCheck)
  176. { ::CheckDlgButton(m_hWnd, nIDButton, nCheck); }
  177. _AFXWIN_INLINE void CWnd::CheckRadioButton(int nIDFirstButton, int nIDLastButton,
  178. int nIDCheckButton)
  179. { ::CheckRadioButton(m_hWnd, nIDFirstButton, nIDLastButton, nIDCheckButton); }
  180. _AFXWIN_INLINE int CWnd::DlgDirList(LPSTR lpPathSpec, int nIDListBox,
  181. int nIDStaticPath, UINT nFileType)
  182. { return ::DlgDirList(m_hWnd, lpPathSpec, nIDListBox,
  183. nIDStaticPath, nFileType); }
  184. _AFXWIN_INLINE int CWnd::DlgDirListComboBox(LPSTR lpPathSpec, int nIDComboBox,
  185. int nIDStaticPath, UINT nFileType)
  186. { return ::DlgDirListComboBox(m_hWnd, lpPathSpec,
  187. nIDComboBox, nIDStaticPath, nFileType); }
  188. _AFXWIN_INLINE BOOL CWnd::DlgDirSelect(LPSTR lpString, int nIDListBox)
  189. { return ::DlgDirSelect(m_hWnd, lpString, nIDListBox); }
  190. _AFXWIN_INLINE BOOL CWnd::DlgDirSelectComboBox(LPSTR lpString, int nIDComboBox)
  191. { return ::DlgDirSelectComboBox(m_hWnd, lpString, nIDComboBox);}
  192. _AFXWIN_INLINE CWnd* CWnd::GetDlgItem(int nID) const
  193. { return CWnd::FromHandle(::GetDlgItem(m_hWnd, nID)); }
  194. _AFXWIN_INLINE UINT CWnd::GetDlgItemInt(int nID, BOOL* lpTrans /* = NULL */,
  195. BOOL bSigned /* = TRUE */) const
  196. { return ::GetDlgItemInt(m_hWnd, nID, lpTrans, bSigned);}
  197. _AFXWIN_INLINE int CWnd::GetDlgItemText(int nID, LPSTR lpStr, int nMaxCount) const
  198. { return ::GetDlgItemText(m_hWnd, nID, lpStr, nMaxCount);}
  199. _AFXWIN_INLINE CWnd* CWnd::GetNextDlgGroupItem(CWnd* pWndCtl, BOOL bPrevious /* = FALSE */) const
  200. { return CWnd::FromHandle(::GetNextDlgGroupItem(m_hWnd,
  201. pWndCtl->m_hWnd, bPrevious)); }
  202. _AFXWIN_INLINE CWnd* CWnd::GetNextDlgTabItem(CWnd* pWndCtl, BOOL bPrevious /* = FALSE */) const
  203. { return CWnd::FromHandle(::GetNextDlgTabItem(m_hWnd,
  204. pWndCtl->m_hWnd, bPrevious)); }
  205. _AFXWIN_INLINE UINT CWnd::IsDlgButtonChecked(int nIDButton) const
  206. { return ::IsDlgButtonChecked(m_hWnd, nIDButton); }
  207. _AFXWIN_INLINE LPARAM CWnd::SendDlgItemMessage(int nID, UINT message, WPARAM wParam /* = 0 */, LPARAM lParam /* = 0 */)
  208. { return ::SendDlgItemMessage(m_hWnd, nID, message, wParam, lParam); }
  209. _AFXWIN_INLINE void CWnd::SetDlgItemInt(int nID, UINT nValue, BOOL bSigned /* = TRUE */)
  210. { ::SetDlgItemInt(m_hWnd, nID, nValue, bSigned); }
  211. _AFXWIN_INLINE void CWnd::SetDlgItemText(int nID, LPCSTR lpszString)
  212. { ::SetDlgItemText(m_hWnd, nID, lpszString); }
  213. _AFXWIN_INLINE void CWnd::ScrollWindow(int xAmount, int yAmount,
  214. LPCRECT lpRect /* = NULL */,
  215. LPCRECT lpClipRect /* = NULL */)
  216. {::ScrollWindow(m_hWnd, xAmount, yAmount, lpRect, lpClipRect); }
  217. #if (WINVER >= 0x030a)
  218. _AFXWIN_INLINE int CWnd::ScrollWindowEx(int dx, int dy,
  219. LPCRECT lpRectScroll, LPCRECT lpRectClip,
  220. CRgn* prgnUpdate, LPRECT lpRectUpdate, UINT flags)
  221. { return ::ScrollWindowEx(m_hWnd, dx, dy, lpRectScroll, lpRectClip,
  222. (HRGN)prgnUpdate->GetSafeHandle(), lpRectUpdate, flags); }
  223. #endif // WINVER >= 0x030a
  224. _AFXWIN_INLINE void CWnd::ShowScrollBar(UINT nBar, BOOL bShow /* = TRUE */)
  225. { ::ShowScrollBar(m_hWnd, nBar, bShow); }
  226. _AFXWIN_INLINE CWnd* CWnd::ChildWindowFromPoint(POINT point) const
  227. { return CWnd::FromHandle(::ChildWindowFromPoint(m_hWnd, point)); }
  228. _AFXWIN_INLINE CWnd* PASCAL CWnd::FindWindow(LPCSTR lpszClassName, LPCSTR lpszWindowName)
  229. { return CWnd::FromHandle(
  230. ::FindWindow(lpszClassName, lpszWindowName)); }
  231. _AFXWIN_INLINE CWnd* CWnd::GetNextWindow(UINT nFlag /* = GW_HWNDNEXT */) const
  232. { return CWnd::FromHandle(::GetNextWindow(m_hWnd, nFlag)); }
  233. _AFXWIN_INLINE CWnd* CWnd::GetTopWindow() const
  234. { return CWnd::FromHandle(::GetTopWindow(m_hWnd)); }
  235. _AFXWIN_INLINE CWnd* CWnd::GetWindow(UINT nCmd) const
  236. { return CWnd::FromHandle(::GetWindow(m_hWnd, nCmd)); }
  237. _AFXWIN_INLINE CWnd* CWnd::GetLastActivePopup() const
  238. { return CWnd::FromHandle(::GetLastActivePopup(m_hWnd)); }
  239. _AFXWIN_INLINE BOOL CWnd::IsChild(const CWnd* pWnd) const
  240. { return ::IsChild(m_hWnd, pWnd->GetSafeHwnd()); }
  241. _AFXWIN_INLINE CWnd* CWnd::GetParent() const
  242. { return CWnd::FromHandle(::GetParent(m_hWnd)); }
  243. _AFXWIN_INLINE CWnd* CWnd::SetParent(CWnd* pWndNewParent)
  244. { return CWnd::FromHandle(::SetParent(m_hWnd,
  245. pWndNewParent->GetSafeHwnd())); }
  246. _AFXWIN_INLINE CWnd* PASCAL CWnd::WindowFromPoint(POINT point)
  247. { return CWnd::FromHandle(::WindowFromPoint(point)); }
  248. _AFXWIN_INLINE BOOL CWnd::FlashWindow(BOOL bInvert)
  249. { return ::FlashWindow(m_hWnd, bInvert); }
  250. _AFXWIN_INLINE BOOL CWnd::ChangeClipboardChain(HWND hWndNext)
  251. { return ::ChangeClipboardChain(m_hWnd, hWndNext); }
  252. _AFXWIN_INLINE HWND CWnd::SetClipboardViewer()
  253. { return ::SetClipboardViewer(m_hWnd); }
  254. _AFXWIN_INLINE BOOL CWnd::OpenClipboard()
  255. { return ::OpenClipboard(m_hWnd); }
  256. #if (WINVER >= 0x030a)
  257. _AFXWIN_INLINE CWnd* PASCAL CWnd::GetOpenClipboardWindow()
  258. { return CWnd::FromHandle(::GetOpenClipboardWindow()); }
  259. #endif // WINVER >= 0x030a
  260. _AFXWIN_INLINE CWnd* PASCAL CWnd::GetClipboardOwner()
  261. { return CWnd::FromHandle(::GetClipboardOwner()); }
  262. _AFXWIN_INLINE CWnd* PASCAL CWnd::GetClipboardViewer()
  263. { return CWnd::FromHandle(::GetClipboardViewer()); }
  264. _AFXWIN_INLINE void CWnd::CreateCaret(CBitmap* pBitmap)
  265. { ::CreateCaret(m_hWnd, (HBITMAP)pBitmap->GetSafeHandle(), 0, 0); }
  266. _AFXWIN_INLINE void CWnd::CreateSolidCaret(int nWidth, int nHeight)
  267. { ::CreateCaret(m_hWnd, (HBITMAP)0, nWidth, nHeight); }
  268. _AFXWIN_INLINE void CWnd::CreateGrayCaret(int nWidth, int nHeight)
  269. { ::CreateCaret(m_hWnd, (HBITMAP)1, nWidth, nHeight); }
  270. _AFXWIN_INLINE CPoint PASCAL CWnd::GetCaretPos()
  271. { CPoint point; ::GetCaretPos((LPPOINT)&point); return point; }
  272. _AFXWIN_INLINE void PASCAL CWnd::SetCaretPos(POINT point)
  273. { ::SetCaretPos(point.x, point.y); }
  274. _AFXWIN_INLINE void CWnd::HideCaret()
  275. { ::HideCaret(m_hWnd); }
  276. _AFXWIN_INLINE void CWnd::ShowCaret()
  277. { ::ShowCaret(m_hWnd); }
  278. #if (WINVER >= 0x030a)
  279. _AFXWIN_INLINE void CWnd::DragAcceptFiles(BOOL bAccept)
  280. { ::DragAcceptFiles(m_hWnd, bAccept); }
  281. #endif // WINVER >= 0x030a
  282. // Default message map implementations
  283. _AFXWIN_INLINE afx_msg void CWnd::OnActivate(UINT, CWnd*, BOOL)
  284. { Default(); }
  285. _AFXWIN_INLINE afx_msg void CWnd::OnActivateApp(BOOL, HTASK)
  286. { Default(); }
  287. _AFXWIN_INLINE afx_msg void CWnd::OnCancelMode()
  288. { Default(); }
  289. _AFXWIN_INLINE afx_msg void CWnd::OnChildActivate()
  290. { Default(); }
  291. _AFXWIN_INLINE afx_msg void CWnd::OnClose()
  292. { Default(); }
  293. _AFXWIN_INLINE afx_msg int CWnd::OnCreate(LPCREATESTRUCT)
  294. { return (int)Default(); }
  295. _AFXWIN_INLINE afx_msg void CWnd::OnDestroy()
  296. { Default(); }
  297. _AFXWIN_INLINE afx_msg void CWnd::OnEnable(BOOL)
  298. { Default(); }
  299. _AFXWIN_INLINE afx_msg void CWnd::OnEndSession(BOOL)
  300. { Default(); }
  301. _AFXWIN_INLINE afx_msg void CWnd::OnEnterIdle(UINT, CWnd*)
  302. { Default(); }
  303. _AFXWIN_INLINE afx_msg BOOL CWnd::OnEraseBkgnd(CDC*)
  304. { return (BOOL)Default(); }
  305. _AFXWIN_INLINE afx_msg void CWnd::OnGetMinMaxInfo(MINMAXINFO FAR*)
  306. { Default(); }
  307. _AFXWIN_INLINE afx_msg void CWnd::OnIconEraseBkgnd(CDC*)
  308. { Default(); }
  309. _AFXWIN_INLINE afx_msg void CWnd::OnKillFocus(CWnd*)
  310. { Default(); }
  311. _AFXWIN_INLINE afx_msg LRESULT CWnd::OnMenuChar(UINT, UINT, CMenu*)
  312. { return Default(); }
  313. _AFXWIN_INLINE afx_msg void CWnd::OnMenuSelect(UINT, UINT, HMENU)
  314. { Default(); }
  315. _AFXWIN_INLINE afx_msg void CWnd::OnMove(int, int)
  316. { Default(); }
  317. _AFXWIN_INLINE afx_msg void CWnd::OnPaint()
  318. { Default(); }
  319. _AFXWIN_INLINE afx_msg HCURSOR CWnd::OnQueryDragIcon()
  320. { return (HCURSOR)Default(); }
  321. _AFXWIN_INLINE afx_msg BOOL CWnd::OnQueryEndSession()
  322. { return (BOOL)Default(); }
  323. _AFXWIN_INLINE afx_msg BOOL CWnd::OnQueryNewPalette()
  324. { return (BOOL)Default(); }
  325. _AFXWIN_INLINE afx_msg BOOL CWnd::OnQueryOpen()
  326. { return (BOOL)Default(); }
  327. _AFXWIN_INLINE afx_msg void CWnd::OnSetFocus(CWnd*)
  328. { Default(); }
  329. _AFXWIN_INLINE afx_msg void CWnd::OnShowWindow(BOOL, UINT)
  330. { Default(); }
  331. _AFXWIN_INLINE afx_msg void CWnd::OnSize(UINT, int, int)
  332. { Default(); }
  333. #if (WINVER >= 0x030a)
  334. _AFXWIN_INLINE afx_msg void CWnd::OnWindowPosChanging(WINDOWPOS FAR*)
  335. { Default(); }
  336. _AFXWIN_INLINE afx_msg void CWnd::OnWindowPosChanged(WINDOWPOS FAR*)
  337. { Default(); }
  338. _AFXWIN_INLINE afx_msg void CWnd::OnDropFiles(HDROP)
  339. { Default(); }
  340. _AFXWIN_INLINE afx_msg void CWnd::OnPaletteIsChanging(CWnd*)
  341. { Default(); }
  342. #endif // WINVER >= 0x030a
  343. _AFXWIN_INLINE afx_msg BOOL CWnd::OnNcActivate(BOOL)
  344. { return (BOOL)Default(); }
  345. _AFXWIN_INLINE afx_msg void CWnd::OnNcCalcSize(BOOL, NCCALCSIZE_PARAMS FAR*)
  346. { Default(); }
  347. _AFXWIN_INLINE afx_msg BOOL CWnd::OnNcCreate(LPCREATESTRUCT)
  348. { return (BOOL)Default(); }
  349. _AFXWIN_INLINE afx_msg UINT CWnd::OnNcHitTest(CPoint)
  350. { return (UINT)Default(); }
  351. _AFXWIN_INLINE afx_msg void CWnd::OnNcLButtonDblClk(UINT, CPoint)
  352. { Default(); }
  353. _AFXWIN_INLINE afx_msg void CWnd::OnNcLButtonDown(UINT, CPoint)
  354. { Default(); }
  355. _AFXWIN_INLINE afx_msg void CWnd::OnNcLButtonUp(UINT, CPoint)
  356. { Default(); }
  357. _AFXWIN_INLINE afx_msg void CWnd::OnNcMButtonDblClk(UINT, CPoint)
  358. { Default(); }
  359. _AFXWIN_INLINE afx_msg void CWnd::OnNcMButtonDown(UINT, CPoint)
  360. { Default(); }
  361. _AFXWIN_INLINE afx_msg void CWnd::OnNcMButtonUp(UINT, CPoint)
  362. { Default(); }
  363. _AFXWIN_INLINE afx_msg void CWnd::OnNcMouseMove(UINT, CPoint)
  364. { Default(); }
  365. _AFXWIN_INLINE afx_msg void CWnd::OnNcPaint()
  366. { Default(); }
  367. _AFXWIN_INLINE afx_msg void CWnd::OnNcRButtonDblClk(UINT, CPoint)
  368. { Default(); }
  369. _AFXWIN_INLINE afx_msg void CWnd::OnNcRButtonDown(UINT, CPoint)
  370. { Default(); }
  371. _AFXWIN_INLINE afx_msg void CWnd::OnNcRButtonUp(UINT, CPoint)
  372. { Default(); }
  373. _AFXWIN_INLINE afx_msg void CWnd::OnSysChar(UINT, UINT, UINT)
  374. { Default(); }
  375. _AFXWIN_INLINE afx_msg void CWnd::OnSysCommand(UINT, LPARAM)
  376. { Default(); }
  377. _AFXWIN_INLINE afx_msg void CWnd::OnSysDeadChar(UINT, UINT, UINT)
  378. { Default(); }
  379. _AFXWIN_INLINE afx_msg void CWnd::OnSysKeyDown(UINT, UINT, UINT)
  380. { Default(); }
  381. _AFXWIN_INLINE afx_msg void CWnd::OnSysKeyUp(UINT, UINT, UINT)
  382. { Default(); }
  383. _AFXWIN_INLINE afx_msg void CWnd::OnCompacting(UINT)
  384. { Default(); }
  385. _AFXWIN_INLINE afx_msg void CWnd::OnDevModeChange(LPSTR)
  386. { Default(); }
  387. _AFXWIN_INLINE afx_msg void CWnd::OnFontChange()
  388. { Default(); }
  389. _AFXWIN_INLINE afx_msg void CWnd::OnPaletteChanged(CWnd*)
  390. { Default(); }
  391. _AFXWIN_INLINE afx_msg void CWnd::OnSpoolerStatus(UINT, UINT)
  392. { Default(); }
  393. _AFXWIN_INLINE afx_msg void CWnd::OnSysColorChange()
  394. { Default(); }
  395. _AFXWIN_INLINE afx_msg void CWnd::OnTimeChange()
  396. { Default(); }
  397. _AFXWIN_INLINE afx_msg void CWnd::OnWinIniChange(LPCSTR)
  398. { Default(); }
  399. _AFXWIN_INLINE afx_msg void CWnd::OnChar(UINT, UINT, UINT)
  400. { Default(); }
  401. _AFXWIN_INLINE afx_msg void CWnd::OnDeadChar(UINT, UINT, UINT)
  402. { Default(); }
  403. _AFXWIN_INLINE afx_msg void CWnd::OnKeyDown(UINT, UINT, UINT)
  404. { Default(); }
  405. _AFXWIN_INLINE afx_msg void CWnd::OnKeyUp(UINT, UINT, UINT)
  406. { Default(); }
  407. _AFXWIN_INLINE afx_msg void CWnd::OnLButtonDblClk(UINT, CPoint)
  408. { Default(); }
  409. _AFXWIN_INLINE afx_msg void CWnd::OnLButtonDown(UINT, CPoint)
  410. { Default(); }
  411. _AFXWIN_INLINE afx_msg void CWnd::OnLButtonUp(UINT, CPoint)
  412. { Default(); }
  413. _AFXWIN_INLINE afx_msg void CWnd::OnMButtonDblClk(UINT, CPoint)
  414. { Default(); }
  415. _AFXWIN_INLINE afx_msg void CWnd::OnMButtonDown(UINT, CPoint)
  416. { Default(); }
  417. _AFXWIN_INLINE afx_msg void CWnd::OnMButtonUp(UINT, CPoint)
  418. { Default(); }
  419. _AFXWIN_INLINE afx_msg int CWnd::OnMouseActivate(CWnd*, UINT, UINT)
  420. { return (int)Default(); }
  421. _AFXWIN_INLINE afx_msg void CWnd::OnMouseMove(UINT, CPoint)
  422. { Default(); }
  423. _AFXWIN_INLINE afx_msg void CWnd::OnRButtonDblClk(UINT, CPoint)
  424. { Default(); }
  425. _AFXWIN_INLINE afx_msg void CWnd::OnRButtonDown(UINT, CPoint)
  426. { Default(); }
  427. _AFXWIN_INLINE afx_msg void CWnd::OnRButtonUp(UINT, CPoint)
  428. { Default(); }
  429. _AFXWIN_INLINE afx_msg BOOL CWnd::OnSetCursor(CWnd*, UINT, UINT)
  430. { return (BOOL)Default(); }
  431. _AFXWIN_INLINE afx_msg void CWnd::OnTimer(UINT)
  432. { Default(); }
  433. _AFXWIN_INLINE afx_msg void CWnd::OnInitMenu(CMenu*)
  434. { Default(); }
  435. _AFXWIN_INLINE afx_msg void CWnd::OnInitMenuPopup(CMenu*, UINT, BOOL)
  436. { Default(); }
  437. _AFXWIN_INLINE afx_msg void CWnd::OnAskCbFormatName(UINT, LPSTR)
  438. { Default(); }
  439. _AFXWIN_INLINE afx_msg void CWnd::OnChangeCbChain(HWND, HWND)
  440. { Default(); }
  441. _AFXWIN_INLINE afx_msg void CWnd::OnDestroyClipboard()
  442. { Default(); }
  443. _AFXWIN_INLINE afx_msg void CWnd::OnDrawClipboard()
  444. { Default(); }
  445. _AFXWIN_INLINE afx_msg void CWnd::OnHScrollClipboard(CWnd*, UINT, UINT)
  446. { Default(); }
  447. _AFXWIN_INLINE afx_msg void CWnd::OnPaintClipboard(CWnd*, HGLOBAL)
  448. { Default(); }
  449. _AFXWIN_INLINE afx_msg void CWnd::OnRenderAllFormats()
  450. { Default(); }
  451. _AFXWIN_INLINE afx_msg void CWnd::OnRenderFormat(UINT)
  452. { Default(); }
  453. _AFXWIN_INLINE afx_msg void CWnd::OnSizeClipboard(CWnd*, HGLOBAL)
  454. { Default(); }
  455. _AFXWIN_INLINE afx_msg void CWnd::OnVScrollClipboard(CWnd*, UINT, UINT)
  456. { Default(); }
  457. _AFXWIN_INLINE afx_msg UINT CWnd::OnGetDlgCode()
  458. { return (UINT)Default(); }
  459. _AFXWIN_INLINE afx_msg int CWnd::OnCharToItem(UINT, CListBox*, UINT)
  460. { return (int)Default(); }
  461. _AFXWIN_INLINE afx_msg int CWnd::OnVKeyToItem(UINT, CListBox*, UINT)
  462. { return (int)Default(); }
  463. _AFXWIN_INLINE afx_msg void CWnd::OnMDIActivate(BOOL, CWnd*, CWnd*)
  464. { Default(); }
  465. // CWnd dialog data support
  466. _AFXWIN_INLINE void CWnd::DoDataExchange(CDataExchange*)
  467. { } // default does nothing
  468. // CFrameWnd
  469. _AFXWIN_INLINE void CFrameWnd::DelayUpdateFrameTitle()
  470. { m_nIdleFlags |= idleTitle; }
  471. _AFXWIN_INLINE void CFrameWnd::DelayRecalcLayout(BOOL bNotify)
  472. { m_nIdleFlags |= (idleLayout | (bNotify ? idleNotify : 0)); };
  473. _AFXWIN_INLINE BOOL CFrameWnd::InModalState() const
  474. { return m_cModalStack != 0; }
  475. // CDialog
  476. _AFXWIN_INLINE BOOL CDialog::Create(UINT nIDTemplate, CWnd* pParentWnd /* = NULL */)
  477. { return Create(MAKEINTRESOURCE(nIDTemplate), pParentWnd); }
  478. _AFXWIN_INLINE void CDialog::MapDialogRect(LPRECT lpRect) const
  479. { ::MapDialogRect(m_hWnd, lpRect); }
  480. _AFXWIN_INLINE void CDialog::SetHelpID(UINT nIDR)
  481. { m_nIDHelp = nIDR; }
  482. _AFXWIN_INLINE BOOL CDialog::IsDialogMessage(LPMSG lpMsg)
  483. { return ::IsDialogMessage(m_hWnd, lpMsg); }
  484. _AFXWIN_INLINE void CDialog::NextDlgCtrl() const
  485. { ::SendMessage(m_hWnd, WM_NEXTDLGCTL, 0, 0); }
  486. _AFXWIN_INLINE void CDialog::PrevDlgCtrl() const
  487. { ::SendMessage(m_hWnd, WM_NEXTDLGCTL, 1, 0); }
  488. _AFXWIN_INLINE void CDialog::GotoDlgCtrl(CWnd* pWndCtrl)
  489. { ::SendMessage(m_hWnd, WM_NEXTDLGCTL, (WPARAM)pWndCtrl->m_hWnd, 1L); }
  490. _AFXWIN_INLINE void CDialog::SetDefID(UINT nID)
  491. { ::SendMessage(m_hWnd, DM_SETDEFID, nID, 0); }
  492. _AFXWIN_INLINE DWORD CDialog::GetDefID() const
  493. { return ::SendMessage(m_hWnd, DM_GETDEFID, 0, 0); }
  494. _AFXWIN_INLINE void CDialog::EndDialog(int nResult)
  495. { ::EndDialog(m_hWnd, nResult); }
  496. // Window control functions
  497. _AFXWIN_INLINE CStatic::CStatic()
  498. { }
  499. _AFXWIN_INLINE CButton::CButton()
  500. { }
  501. #if (WINVER >= 0x030a)
  502. _AFXWIN_INLINE HICON CStatic::SetIcon(HICON hIcon)
  503. { return (HICON)::SendMessage(m_hWnd, STM_SETICON, (WPARAM)hIcon, 0L); }
  504. _AFXWIN_INLINE HICON CStatic::GetIcon() const
  505. { return (HICON)::SendMessage(m_hWnd, STM_GETICON, 0, 0L); }
  506. #endif // WINVER >= 0x030a
  507. _AFXWIN_INLINE UINT CButton::GetState() const
  508. { return (UINT)::SendMessage(m_hWnd, BM_GETSTATE, 0, 0); }
  509. _AFXWIN_INLINE void CButton::SetState(BOOL bHighlight)
  510. { ::SendMessage(m_hWnd, BM_SETSTATE, bHighlight, 0); }
  511. _AFXWIN_INLINE int CButton::GetCheck() const
  512. { return (int)::SendMessage(m_hWnd, BM_GETCHECK, 0, 0); }
  513. _AFXWIN_INLINE void CButton::SetCheck(int nCheck)
  514. { ::SendMessage(m_hWnd, BM_SETCHECK, nCheck, 0); }
  515. _AFXWIN_INLINE UINT CButton::GetButtonStyle() const
  516. { return (UINT)GetWindowLong(m_hWnd, GWL_STYLE) & 0xff; }
  517. _AFXWIN_INLINE void CButton::SetButtonStyle(UINT nStyle, BOOL bRedraw /* = TRUE */)
  518. { ::SendMessage(m_hWnd, BM_SETSTYLE, nStyle, (LPARAM)bRedraw); }
  519. _AFXWIN_INLINE CListBox::CListBox()
  520. { }
  521. _AFXWIN_INLINE int CListBox::GetCount() const
  522. { return (int)::SendMessage(m_hWnd, LB_GETCOUNT, 0, 0); }
  523. _AFXWIN_INLINE int CListBox::GetCurSel() const
  524. { return (int)::SendMessage(m_hWnd, LB_GETCURSEL, 0, 0); }
  525. _AFXWIN_INLINE int CListBox::SetCurSel(int nSelect)
  526. { return (int)::SendMessage(m_hWnd, LB_SETCURSEL, nSelect, 0); }
  527. _AFXWIN_INLINE int CListBox::GetHorizontalExtent() const
  528. { return (int)::SendMessage(m_hWnd, LB_GETHORIZONTALEXTENT,
  529. 0, 0); }
  530. _AFXWIN_INLINE void CListBox::SetHorizontalExtent(int cxExtent)
  531. { ::SendMessage(m_hWnd, LB_SETHORIZONTALEXTENT, cxExtent, 0); }
  532. _AFXWIN_INLINE int CListBox::GetSelCount() const
  533. { return (int)::SendMessage(m_hWnd, LB_GETSELCOUNT, 0, 0); }
  534. _AFXWIN_INLINE int CListBox::GetSelItems(int nMaxItems, LPINT rgIndex) const
  535. { return (int)::SendMessage(m_hWnd, LB_GETSELITEMS, nMaxItems, (LPARAM)rgIndex); }
  536. _AFXWIN_INLINE int CListBox::GetTopIndex() const
  537. { return (int)::SendMessage(m_hWnd, LB_GETTOPINDEX, 0, 0); }
  538. _AFXWIN_INLINE int CListBox::SetTopIndex(int nIndex)
  539. { return (int)::SendMessage(m_hWnd, LB_SETTOPINDEX, nIndex, 0);}
  540. _AFXWIN_INLINE DWORD CListBox::GetItemData(int nIndex) const
  541. { return ::SendMessage(m_hWnd, LB_GETITEMDATA, nIndex, 0); }
  542. _AFXWIN_INLINE int CListBox::SetItemData(int nIndex, DWORD dwItemData)
  543. { return (int)::SendMessage(m_hWnd, LB_SETITEMDATA, nIndex, (LPARAM)dwItemData); }
  544. _AFXWIN_INLINE void* CListBox::GetItemDataPtr(int nIndex) const
  545. { return _AfxGetPtrFromFarPtr((LPVOID)::SendMessage(m_hWnd, LB_GETITEMDATA, nIndex, 0)); }
  546. _AFXWIN_INLINE int CListBox::SetItemDataPtr(int nIndex, void* pData)
  547. { return SetItemData(nIndex, (DWORD)(LPVOID)pData); }
  548. _AFXWIN_INLINE int CListBox::GetItemRect(int nIndex, LPRECT lpRect) const
  549. { return (int)::SendMessage(m_hWnd, LB_GETITEMRECT, nIndex, (LPARAM)lpRect); }
  550. _AFXWIN_INLINE int CListBox::GetSel(int nIndex) const
  551. { return (int)::SendMessage(m_hWnd, LB_GETSEL, nIndex, 0); }
  552. _AFXWIN_INLINE int CListBox::SetSel(int nIndex, BOOL bSelect)
  553. { return (int)::SendMessage(m_hWnd, LB_SETSEL, bSelect, nIndex); }
  554. _AFXWIN_INLINE int CListBox::GetText(int nIndex, LPSTR lpszBuffer) const
  555. { return (int)::SendMessage(m_hWnd, LB_GETTEXT, nIndex, (LPARAM)lpszBuffer); }
  556. _AFXWIN_INLINE int CListBox::GetTextLen(int nIndex) const
  557. { return (int)::SendMessage(m_hWnd, LB_GETTEXTLEN, nIndex, 0); }
  558. _AFXWIN_INLINE void CListBox::GetText(int nIndex, CString& rString) const
  559. { GetText(nIndex, rString.GetBufferSetLength(GetTextLen(nIndex))); }
  560. _AFXWIN_INLINE void CListBox::SetColumnWidth(int cxWidth)
  561. { ::SendMessage(m_hWnd, LB_SETCOLUMNWIDTH, cxWidth, 0); }
  562. _AFXWIN_INLINE BOOL CListBox::SetTabStops(int nTabStops, LPINT rgTabStops)
  563. { return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, nTabStops, (LPARAM)rgTabStops); }
  564. _AFXWIN_INLINE void CListBox::SetTabStops()
  565. { VERIFY(::SendMessage(m_hWnd, LB_SETTABSTOPS, 0, 0)); }
  566. _AFXWIN_INLINE BOOL CListBox::SetTabStops(const int& cxEachStop)
  567. { return (BOOL)::SendMessage(m_hWnd, LB_SETTABSTOPS, 1, (LPARAM)(LPINT)&cxEachStop); }
  568. #if (WINVER >= 0x030a)
  569. _AFXWIN_INLINE int CListBox::SetItemHeight(int nIndex, UINT cyItemHeight)
  570. { return (int)::SendMessage(m_hWnd, LB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); }
  571. _AFXWIN_INLINE int CListBox::GetItemHeight(int nIndex) const
  572. { return (int)::SendMessage(m_hWnd, LB_GETITEMHEIGHT, nIndex, 0L); }
  573. _AFXWIN_INLINE int CListBox::FindStringExact(int nIndexStart, LPCSTR lpszFind) const
  574. { return (int)::SendMessage(m_hWnd, LB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); }
  575. _AFXWIN_INLINE int CListBox::GetCaretIndex() const
  576. { return (int)::SendMessage(m_hWnd, LB_GETCARETINDEX, 0, 0L); }
  577. _AFXWIN_INLINE int CListBox::SetCaretIndex(int nIndex, BOOL bScroll /* = TRUE */)
  578. { return (int)::SendMessage(m_hWnd, LB_SETCARETINDEX, nIndex, MAKELONG(bScroll, 0)); }
  579. #endif // WINVER >= 0x030a
  580. _AFXWIN_INLINE int CListBox::AddString(LPCSTR lpszItem)
  581. { return (int)::SendMessage(m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); }
  582. _AFXWIN_INLINE int CListBox::DeleteString(UINT nIndex)
  583. { return (int)::SendMessage(m_hWnd, LB_DELETESTRING, nIndex, 0); }
  584. _AFXWIN_INLINE int CListBox::InsertString(int nIndex, LPCSTR lpszItem)
  585. { return (int)::SendMessage(m_hWnd, LB_INSERTSTRING, nIndex, (LPARAM)lpszItem); }
  586. _AFXWIN_INLINE void CListBox::ResetContent()
  587. { ::SendMessage(m_hWnd, LB_RESETCONTENT, 0, 0); }
  588. _AFXWIN_INLINE int CListBox::Dir(UINT attr, LPCSTR lpszWildCard)
  589. { return (int)::SendMessage(m_hWnd, LB_DIR, attr, (LPARAM)lpszWildCard); }
  590. _AFXWIN_INLINE int CListBox::FindString(int nStartAfter, LPCSTR lpszItem) const
  591. { return (int)::SendMessage(m_hWnd, LB_FINDSTRING,
  592. nStartAfter, (LPARAM)lpszItem); }
  593. _AFXWIN_INLINE int CListBox::SelectString(int nStartAfter, LPCSTR lpszItem)
  594. { return (int)::SendMessage(m_hWnd, LB_SELECTSTRING,
  595. nStartAfter, (LPARAM)lpszItem); }
  596. _AFXWIN_INLINE int CListBox::SelItemRange(BOOL bSelect, int nFirstItem, int nLastItem)
  597. { return (int)::SendMessage(m_hWnd, LB_SELITEMRANGE, bSelect,
  598. MAKELONG(nFirstItem, nLastItem)); }
  599. _AFXWIN_INLINE CComboBox::CComboBox()
  600. { }
  601. _AFXWIN_INLINE int CComboBox::GetCount() const
  602. { return (int)::SendMessage(m_hWnd, CB_GETCOUNT, 0, 0); }
  603. _AFXWIN_INLINE int CComboBox::GetCurSel() const
  604. { return (int)::SendMessage(m_hWnd, CB_GETCURSEL, 0, 0); }
  605. _AFXWIN_INLINE int CComboBox::SetCurSel(int nSelect)
  606. { return (int)::SendMessage(m_hWnd, CB_SETCURSEL, nSelect, 0); }
  607. _AFXWIN_INLINE DWORD CComboBox::GetEditSel() const
  608. { return ::SendMessage(m_hWnd, CB_GETEDITSEL, 0, 0); }
  609. _AFXWIN_INLINE BOOL CComboBox::LimitText(int nMaxChars)
  610. { return (BOOL)::SendMessage(m_hWnd, CB_LIMITTEXT, nMaxChars, 0); }
  611. _AFXWIN_INLINE BOOL CComboBox::SetEditSel(int nStartChar, int nEndChar)
  612. { return (BOOL)::SendMessage(m_hWnd, CB_SETEDITSEL, 0, MAKELONG(nStartChar, nEndChar)); }
  613. _AFXWIN_INLINE DWORD CComboBox::GetItemData(int nIndex) const
  614. { return ::SendMessage(m_hWnd, CB_GETITEMDATA, nIndex, 0); }
  615. _AFXWIN_INLINE int CComboBox::SetItemData(int nIndex, DWORD dwItemData)
  616. { return (int)::SendMessage(m_hWnd, CB_SETITEMDATA, nIndex, (LPARAM)dwItemData); }
  617. _AFXWIN_INLINE void* CComboBox::GetItemDataPtr(int nIndex) const
  618. { return _AfxGetPtrFromFarPtr((LPVOID)GetItemData(nIndex)); }
  619. _AFXWIN_INLINE int CComboBox::SetItemDataPtr(int nIndex, void* pData)
  620. { return SetItemData(nIndex, (DWORD)(LPVOID)pData); }
  621. _AFXWIN_INLINE int CComboBox::GetLBText(int nIndex, LPSTR lpszText) const
  622. { return (int)::SendMessage(m_hWnd, CB_GETLBTEXT, nIndex, (LPARAM)lpszText); }
  623. _AFXWIN_INLINE int CComboBox::GetLBTextLen(int nIndex) const
  624. { return (int)::SendMessage(m_hWnd, CB_GETLBTEXTLEN, nIndex, 0); }
  625. _AFXWIN_INLINE void CComboBox::GetLBText(int nIndex, CString& rString) const
  626. { GetLBText(nIndex, rString.GetBufferSetLength(GetLBTextLen(nIndex))); }
  627. _AFXWIN_INLINE void CComboBox::ShowDropDown(BOOL bShowIt /* = TRUE */)
  628. { ::SendMessage(m_hWnd, CB_SHOWDROPDOWN, bShowIt, 0); }
  629. _AFXWIN_INLINE int CComboBox::AddString(LPCSTR lpszString)
  630. { return (int)::SendMessage(m_hWnd, CB_ADDSTRING, 0, (LPARAM)lpszString); }
  631. _AFXWIN_INLINE int CComboBox::DeleteString(UINT nIndex)
  632. { return (int)::SendMessage(m_hWnd, CB_DELETESTRING, nIndex, 0);}
  633. _AFXWIN_INLINE int CComboBox::InsertString(int nIndex, LPCSTR lpszString)
  634. { return (int)::SendMessage(m_hWnd, CB_INSERTSTRING, nIndex, (LPARAM)lpszString); }
  635. _AFXWIN_INLINE void CComboBox::ResetContent()
  636. { ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); }
  637. _AFXWIN_INLINE int CComboBox::Dir(UINT attr, LPCSTR lpszWildCard)
  638. { return (int)::SendMessage(m_hWnd, CB_DIR, attr, (LPARAM)lpszWildCard); }
  639. _AFXWIN_INLINE int CComboBox::FindString(int nStartAfter, LPCSTR lpszString) const
  640. { return (int)::SendMessage(m_hWnd, CB_FINDSTRING, nStartAfter,
  641. (LPARAM)lpszString); }
  642. _AFXWIN_INLINE int CComboBox::SelectString(int nStartAfter, LPCSTR lpszString)
  643. { return (int)::SendMessage(m_hWnd, CB_SELECTSTRING,
  644. nStartAfter, (LPARAM)lpszString); }
  645. _AFXWIN_INLINE void CComboBox::Clear()
  646. { ::SendMessage(m_hWnd, WM_CLEAR, 0, 0); }
  647. _AFXWIN_INLINE void CComboBox::Copy()
  648. { ::SendMessage(m_hWnd, WM_COPY, 0, 0); }
  649. _AFXWIN_INLINE void CComboBox::Cut()
  650. { ::SendMessage(m_hWnd, WM_CUT, 0, 0); }
  651. _AFXWIN_INLINE void CComboBox::Paste()
  652. { ::SendMessage(m_hWnd, WM_PASTE, 0, 0); }
  653. #if (WINVER >= 0x030a)
  654. _AFXWIN_INLINE int CComboBox::SetItemHeight(int nIndex, UINT cyItemHeight)
  655. { return (int)::SendMessage(m_hWnd, CB_SETITEMHEIGHT, nIndex, MAKELONG(cyItemHeight, 0)); }
  656. _AFXWIN_INLINE int CComboBox::GetItemHeight(int nIndex) const
  657. { return (int)::SendMessage(m_hWnd, CB_GETITEMHEIGHT, nIndex, 0L); }
  658. _AFXWIN_INLINE int CComboBox::FindStringExact(int nIndexStart, LPCSTR lpszFind) const
  659. { return (int)::SendMessage(m_hWnd, CB_FINDSTRINGEXACT, nIndexStart, (LPARAM)lpszFind); }
  660. _AFXWIN_INLINE int CComboBox::SetExtendedUI(BOOL bExtended /* = TRUE */ )
  661. { return (int)::SendMessage(m_hWnd, CB_SETEXTENDEDUI, bExtended, 0L); }
  662. _AFXWIN_INLINE BOOL CComboBox::GetExtendedUI() const
  663. { return (BOOL)::SendMessage(m_hWnd, CB_GETEXTENDEDUI, 0, 0L); }
  664. _AFXWIN_INLINE void CComboBox::GetDroppedControlRect(LPRECT lprect) const
  665. { ::SendMessage(m_hWnd, CB_GETDROPPEDCONTROLRECT, 0, (DWORD)lprect); }
  666. _AFXWIN_INLINE BOOL CComboBox::GetDroppedState() const
  667. { return (BOOL)::SendMessage(m_hWnd, CB_GETDROPPEDSTATE, 0, 0L); }
  668. #endif // WINVER >= 0x030a
  669. _AFXWIN_INLINE CEdit::CEdit()
  670. { }
  671. _AFXWIN_INLINE BOOL CEdit::CanUndo() const
  672. { return (BOOL)::SendMessage(m_hWnd, EM_CANUNDO, 0, 0); }
  673. _AFXWIN_INLINE int CEdit::GetLineCount() const
  674. { return (int)::SendMessage(m_hWnd, EM_GETLINECOUNT, 0, 0); }
  675. _AFXWIN_INLINE BOOL CEdit::GetModify() const
  676. { return (BOOL)::SendMessage(m_hWnd, EM_GETMODIFY, 0, 0); }
  677. _AFXWIN_INLINE void CEdit::SetModify(BOOL bModified /* = TRUE */)
  678. { ::SendMessage(m_hWnd, EM_SETMODIFY, bModified, 0); }
  679. _AFXWIN_INLINE void CEdit::GetRect(LPRECT lpRect) const
  680. { ::SendMessage(m_hWnd, EM_GETRECT, 0, (LPARAM)lpRect); }
  681. _AFXWIN_INLINE void CEdit::GetSel(int& nStartChar, int& nEndChar) const
  682. {
  683. DWORD dwSel = (DWORD)::SendMessage(m_hWnd, EM_GETSEL, 0, 0);
  684. nStartChar = (int)LOWORD(dwSel);
  685. nEndChar = (int)HIWORD(dwSel);
  686. }
  687. _AFXWIN_INLINE DWORD CEdit::GetSel() const
  688. { return ::SendMessage(m_hWnd, EM_GETSEL, 0, 0); }
  689. _AFXWIN_INLINE HLOCAL CEdit::GetHandle() const
  690. { return (HLOCAL)::SendMessage(m_hWnd, EM_GETHANDLE, 0, 0); }
  691. _AFXWIN_INLINE void CEdit::SetHandle(HLOCAL hBuffer)
  692. { ::SendMessage(m_hWnd, EM_SETHANDLE, (WPARAM)hBuffer, 0); }
  693. _AFXWIN_INLINE int CEdit::GetLine(int nIndex, LPSTR lpszBuffer) const
  694. { return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); }
  695. _AFXWIN_INLINE int CEdit::GetLine(int nIndex, LPSTR lpszBuffer, int nMaxLength) const
  696. {
  697. *(LPINT)lpszBuffer = nMaxLength;
  698. return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer);
  699. }
  700. _AFXWIN_INLINE void CEdit::EmptyUndoBuffer()
  701. { ::SendMessage(m_hWnd, EM_EMPTYUNDOBUFFER, 0, 0); }
  702. _AFXWIN_INLINE BOOL CEdit::FmtLines(BOOL bAddEOL)
  703. { return (BOOL)::SendMessage(m_hWnd, EM_FMTLINES, bAddEOL, 0); }
  704. _AFXWIN_INLINE void CEdit::LimitText(int nChars /* = 0 */)
  705. { ::SendMessage(m_hWnd, EM_LIMITTEXT, nChars, 0); }
  706. _AFXWIN_INLINE int CEdit::LineFromChar(int nIndex /* = -1 */) const
  707. { return (int)::SendMessage(m_hWnd, EM_LINEFROMCHAR, nIndex, 0); }
  708. _AFXWIN_INLINE int CEdit::LineIndex(int nLine /* = -1 */) const
  709. { return (int)::SendMessage(m_hWnd, EM_LINEINDEX, nLine, 0); }
  710. _AFXWIN_INLINE int CEdit::LineLength(int nLine /* = -1 */) const
  711. { return (int)::SendMessage(m_hWnd, EM_LINELENGTH, nLine, 0); }
  712. _AFXWIN_INLINE void CEdit::LineScroll(int nLines, int nChars /* = 0 */)
  713. { ::SendMessage(m_hWnd, EM_LINESCROLL, 0, MAKELONG(nLines, nChars)); }
  714. _AFXWIN_INLINE void CEdit::ReplaceSel(LPCSTR lpszNewText)
  715. { ::SendMessage(m_hWnd, EM_REPLACESEL, 0, (LPARAM)lpszNewText); }
  716. _AFXWIN_INLINE void CEdit::SetPasswordChar(char ch)
  717. { ::SendMessage(m_hWnd, EM_SETPASSWORDCHAR, ch, 0); }
  718. _AFXWIN_INLINE void CEdit::SetRect(LPCRECT lpRect)
  719. { ::SendMessage(m_hWnd, EM_SETRECT, 0, (LPARAM)lpRect); }
  720. _AFXWIN_INLINE void CEdit::SetRectNP(LPCRECT lpRect)
  721. { ::SendMessage(m_hWnd, EM_SETRECTNP, 0, (LPARAM)lpRect); }
  722. _AFXWIN_INLINE void CEdit::SetSel(DWORD dwSelection, BOOL bNoScroll)
  723. { ::SendMessage(m_hWnd, EM_SETSEL, bNoScroll, (LPARAM)dwSelection); }
  724. _AFXWIN_INLINE void CEdit::SetSel(int nStartChar, int nEndChar, BOOL bNoScroll)
  725. { ::SendMessage(m_hWnd, EM_SETSEL, bNoScroll,
  726. MAKELONG(nStartChar, nEndChar)); }
  727. _AFXWIN_INLINE BOOL CEdit::SetTabStops(int nTabStops, LPINT rgTabStops)
  728. { return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS, nTabStops,
  729. (LPARAM)rgTabStops); }
  730. _AFXWIN_INLINE void CEdit::SetTabStops()
  731. { VERIFY(::SendMessage(m_hWnd, EM_SETTABSTOPS, 0, 0)); }
  732. _AFXWIN_INLINE BOOL CEdit::SetTabStops(const int& cxEachStop)
  733. { return (BOOL)::SendMessage(m_hWnd, EM_SETTABSTOPS,
  734. 1, (LPARAM)(LPINT)&cxEachStop); }
  735. _AFXWIN_INLINE BOOL CEdit::Undo()
  736. { return (BOOL)::SendMessage(m_hWnd, EM_UNDO, 0, 0); }
  737. _AFXWIN_INLINE void CEdit::Clear()
  738. { ::SendMessage(m_hWnd, WM_CLEAR, 0, 0); }
  739. _AFXWIN_INLINE void CEdit::Copy()
  740. { ::SendMessage(m_hWnd, WM_COPY, 0, 0); }
  741. _AFXWIN_INLINE void CEdit::Cut()
  742. { ::SendMessage(m_hWnd, WM_CUT, 0, 0); }
  743. _AFXWIN_INLINE void CEdit::Paste()
  744. { ::SendMessage(m_hWnd, WM_PASTE, 0, 0); }
  745. #if (WINVER >= 0x030a)
  746. _AFXWIN_INLINE BOOL CEdit::SetReadOnly(BOOL bReadOnly /* = TRUE */ )
  747. { return (BOOL)::SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L); }
  748. _AFXWIN_INLINE int CEdit::GetFirstVisibleLine() const
  749. { return (int)::SendMessage(m_hWnd, EM_GETFIRSTVISIBLELINE, 0, 0L); }
  750. _AFXWIN_INLINE char CEdit::GetPasswordChar() const
  751. { return (char)::SendMessage(m_hWnd, EM_GETPASSWORDCHAR, 0, 0L); }
  752. #endif // WINVER >= 0x030a
  753. _AFXWIN_INLINE CScrollBar::CScrollBar()
  754. { }
  755. _AFXWIN_INLINE int CScrollBar::GetScrollPos() const
  756. { return ::GetScrollPos(m_hWnd, SB_CTL); }
  757. _AFXWIN_INLINE int CScrollBar::SetScrollPos(int nPos, BOOL bRedraw /* = TRUE */)
  758. { return ::SetScrollPos(m_hWnd, SB_CTL, nPos, bRedraw); }
  759. _AFXWIN_INLINE void CScrollBar::GetScrollRange(LPINT lpMinPos, LPINT lpMaxPos) const
  760. { ::GetScrollRange(m_hWnd, SB_CTL, lpMinPos, lpMaxPos); }
  761. _AFXWIN_INLINE void CScrollBar::SetScrollRange(int nMinPos, int nMaxPos, BOOL bRedraw /* = TRUE */)
  762. { ::SetScrollRange(m_hWnd, SB_CTL, nMinPos, nMaxPos, bRedraw); }
  763. _AFXWIN_INLINE void CScrollBar::ShowScrollBar(BOOL bShow /* = TRUE */)
  764. { ::ShowScrollBar(m_hWnd, SB_CTL, bShow); }
  765. #if (WINVER >= 0x030a)
  766. _AFXWIN_INLINE BOOL CScrollBar::EnableScrollBar(UINT nArrowFlags /* = ESB_ENABLE_BOTH */ )
  767. { return ::EnableScrollBar(m_hWnd, SB_CTL, nArrowFlags); }
  768. #endif // WINVER >= 0x030a
  769. // MDI functions
  770. #ifndef _AFXCTL
  771. _AFXWIN_INLINE void CMDIFrameWnd::MDIActivate(CWnd* pWndActivate)
  772. { ::SendMessage(m_hWndMDIClient, WM_MDIACTIVATE,
  773. (WPARAM)pWndActivate->m_hWnd, 0); }
  774. _AFXWIN_INLINE void CMDIFrameWnd::MDIIconArrange()
  775. { ::SendMessage(m_hWndMDIClient, WM_MDIICONARRANGE, 0, 0); }
  776. _AFXWIN_INLINE void CMDIFrameWnd::MDIMaximize(CWnd* pWnd)
  777. { ::SendMessage(m_hWndMDIClient, WM_MDIMAXIMIZE, (WPARAM)pWnd->m_hWnd, 0); }
  778. _AFXWIN_INLINE void CMDIFrameWnd::MDINext()
  779. { ::SendMessage(m_hWndMDIClient, WM_MDINEXT, 0, 0); }
  780. _AFXWIN_INLINE void CMDIFrameWnd::MDIRestore(CWnd* pWnd)
  781. { ::SendMessage(m_hWndMDIClient, WM_MDIRESTORE, (WPARAM)pWnd->m_hWnd, 0); }
  782. _AFXWIN_INLINE CMenu* CMDIFrameWnd::MDISetMenu(CMenu* pFrameMenu, CMenu* pWindowMenu)
  783. { return CMenu::FromHandle((HMENU)::SendMessage(
  784. m_hWndMDIClient, WM_MDISETMENU, 0,
  785. MAKELONG(pFrameMenu->GetSafeHmenu(),
  786. pWindowMenu->GetSafeHmenu())));
  787. }
  788. _AFXWIN_INLINE void CMDIFrameWnd::MDITile()
  789. { ::SendMessage(m_hWndMDIClient, WM_MDITILE, 0, 0); }
  790. _AFXWIN_INLINE void CMDIFrameWnd::MDICascade()
  791. { ::SendMessage(m_hWndMDIClient, WM_MDICASCADE, 0, 0); }
  792. #if (WINVER >= 0x030a)
  793. _AFXWIN_INLINE void CMDIFrameWnd::MDICascade(int nType)
  794. { ::SendMessage(m_hWndMDIClient, WM_MDICASCADE, nType, 0); }
  795. _AFXWIN_INLINE void CMDIFrameWnd::MDITile(int nType)
  796. { ::SendMessage(m_hWndMDIClient, WM_MDITILE, nType, 0); }
  797. #endif // WINVER >= 0x030a
  798. _AFXWIN_INLINE void CMDIChildWnd::MDIDestroy()
  799. { ::SendMessage(GetParent()->m_hWnd, WM_MDIDESTROY, (WPARAM)m_hWnd, 0L); }
  800. _AFXWIN_INLINE void CMDIChildWnd::MDIActivate()
  801. { ::SendMessage(GetParent()->m_hWnd, WM_MDIACTIVATE, (WPARAM)m_hWnd, 0L); }
  802. _AFXWIN_INLINE void CMDIChildWnd::MDIMaximize()
  803. { ::SendMessage(GetParent()->m_hWnd, WM_MDIMAXIMIZE, (WPARAM)m_hWnd, 0L); }
  804. _AFXWIN_INLINE void CMDIChildWnd::MDIRestore()
  805. { ::SendMessage(GetParent()->m_hWnd, WM_MDIRESTORE, (WPARAM)m_hWnd, 0L); }
  806. #endif //_AFXCTL
  807. // CView
  808. _AFXWIN_INLINE CDocument* CView::GetDocument() const
  809. { return m_pDocument; }
  810. _AFXWIN_INLINE CSize CScrollView::GetTotalSize() const
  811. { return m_totalLog; }
  812. // CDocument
  813. _AFXWIN_INLINE const CString& CDocument::GetTitle() const
  814. { return m_strTitle; }
  815. _AFXWIN_INLINE const CString& CDocument::GetPathName() const
  816. { return m_strPathName; }
  817. _AFXWIN_INLINE CDocTemplate* CDocument::GetDocTemplate() const
  818. { return m_pDocTemplate; }
  819. _AFXWIN_INLINE BOOL CDocument::IsModified()
  820. { return m_bModified; }
  821. _AFXWIN_INLINE void CDocument::SetModifiedFlag(BOOL bModified)
  822. { m_bModified = bModified; }
  823. // CWinApp
  824. _AFXWIN_INLINE HCURSOR CWinApp::LoadCursor(LPCSTR lpszResourceName) const
  825. { return ::LoadCursor(AfxGetResourceHandle(), lpszResourceName); }
  826. _AFXWIN_INLINE HCURSOR CWinApp::LoadCursor(UINT nIDResource) const
  827. { return ::LoadCursor(AfxGetResourceHandle(),
  828. MAKEINTRESOURCE(nIDResource)); }
  829. _AFXWIN_INLINE HCURSOR CWinApp::LoadStandardCursor(LPCSTR lpszCursorName) const
  830. { return ::LoadCursor(NULL, lpszCursorName); }
  831. _AFXWIN_INLINE HCURSOR CWinApp::LoadOEMCursor(UINT nIDCursor) const
  832. { return ::LoadCursor(NULL, MAKEINTRESOURCE(nIDCursor)); }
  833. _AFXWIN_INLINE HICON CWinApp::LoadIcon(LPCSTR lpszResourceName) const
  834. { return ::LoadIcon(AfxGetResourceHandle(), lpszResourceName); }
  835. _AFXWIN_INLINE HICON CWinApp::LoadIcon(UINT nIDResource) const
  836. { return ::LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(nIDResource)); }
  837. _AFXWIN_INLINE HICON CWinApp::LoadStandardIcon(LPCSTR lpszIconName) const
  838. { return ::LoadIcon(NULL, lpszIconName); }
  839. _AFXWIN_INLINE HICON CWinApp::LoadOEMIcon(UINT nIDIcon) const
  840. { return ::LoadIcon(NULL, MAKEINTRESOURCE(nIDIcon)); }
  841. /////////////////////////////////////////////////////////////////////////////
  842. // Obsolete and non-portable
  843. _AFXWIN_INLINE void CWnd::CloseWindow()
  844. { ::CloseWindow(m_hWnd); }
  845. _AFXWIN_INLINE BOOL CWnd::OpenIcon()
  846. { return ::OpenIcon(m_hWnd); }
  847. _AFXWIN_INLINE CWnd* CWnd::SetSysModalWindow()
  848. { return CWnd::FromHandle(::SetSysModalWindow(m_hWnd)); }
  849. _AFXWIN_INLINE CWnd* PASCAL CWnd::GetSysModalWindow()
  850. { return CWnd::FromHandle(::GetSysModalWindow()); }
  851. /////////////////////////////////////////////////////////////////////////////
  852. #endif //_AFXWIN_INLINE