Click here to Skip to main content
15,885,244 members
Articles / Web Development / HTML

A Comprehensive CE Class Library to Replace ATL and MFC

Rate me:
Please Sign up or sign in to vote.
4.48/5 (14 votes)
4 Oct 2000CPOL 278.5K   998   70  
A collection of classes for CE that do not use ATL or MFC, plus an FTP client, database viewer, and sample application that solves beam deflection equations.
// Binding

inline BOOL CeBaseWnd::Attach(HWND hWndNew)
	{ CHW_ASSERT(::IsWindow(hWndNew)); CHW_ASSERT(NULL == m_hWnd); if (! m_hWnd) m_hWnd = hWndNew; else return FALSE; return TRUE; }
inline HWND CeBaseWnd::Detach()
	{ CHW_ASSERT(NULL != m_hWnd); HWND hWnd = m_hWnd; m_hWnd = NULL; return hWnd; }
inline BOOL CeBaseWnd::DestroyWindow()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); if(!::DestroyWindow(m_hWnd)) return FALSE; m_hWnd = NULL; return TRUE; }

// Attributes

inline DWORD CeBaseWnd::GetStyle() const
	{ CHW_ASSERT(::IsWindow(m_hWnd));	return (DWORD)::GetWindowLong(m_hWnd, GWL_STYLE); }
inline DWORD CeBaseWnd::GetExStyle() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return (DWORD)::GetWindowLong(m_hWnd, GWL_EXSTYLE); }
inline LONG CeBaseWnd::GetWindowLong(int nIndex) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetWindowLong(m_hWnd, nIndex); }
inline LONG CeBaseWnd::SetWindowLong(int nIndex, LONG dwNewLong)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetWindowLong(m_hWnd, nIndex, dwNewLong); }
#ifndef _WIN32_WCE
inline WORD CeBaseWnd::GetWindowWord(int nIndex) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetWindowWord(m_hWnd, nIndex); }
inline WORD CeBaseWnd::SetWindowWord(int nIndex, WORD wNewWord)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetWindowWord(m_hWnd, nIndex, wNewWord); }
#endif

// Message Functions

inline LRESULT CeBaseWnd::SendMessage(UINT message, WPARAM wParam, LPARAM lParam)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SendMessage(m_hWnd,message,wParam,lParam); }
inline BOOL CeBaseWnd::PostMessage(UINT message, WPARAM wParam, LPARAM lParam)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::PostMessage(m_hWnd,message,wParam,lParam); }
inline BOOL CeBaseWnd::SendNotifyMessage(UINT message, WPARAM wParam, LPARAM lParam)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SendNotifyMessage(m_hWnd, message, wParam, lParam); }
// support for C style macros 
inline LRESULT CeBaseWnd::SendMessage(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
	{ CHW_ASSERT(::IsWindow(hWnd)); return ::SendMessage(hWnd, message, wParam, lParam); }

// Window Text Functions

inline BOOL CeBaseWnd::SetWindowText(LPCTSTR lpszString)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetWindowText(m_hWnd, lpszString); }
inline int CeBaseWnd::GetWindowText(LPTSTR lpszStringBuf, int nMaxCount) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetWindowText(m_hWnd, lpszStringBuf, nMaxCount); }
inline int CeBaseWnd::GetWindowTextLength() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetWindowTextLength(m_hWnd); }

// Font Functions

inline void CeBaseWnd::SetFont(HFONT hFont, BOOL bRedraw)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(bRedraw, 0)); }
inline HFONT CeBaseWnd::GetFont() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return (HFONT)::SendMessage(m_hWnd, WM_GETFONT, 0, 0); }

// Menu Functions (non-child windows only)

#ifndef _WIN32_WCE
inline HMENU CeBaseWnd::GetMenu() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetMenu(m_hWnd); }
inline BOOL CeBaseWnd::SetMenu(HMENU hMenu)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetMenu(m_hWnd, hMenu); }
inline HMENU CeBaseWnd::GetSystemMenu(BOOL bRevert) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetSystemMenu(m_hWnd, bRevert); }
inline BOOL CeBaseWnd::HiliteMenuItem(HMENU hMenu, UINT uItemHilite, UINT uHilite)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::HiliteMenuItem(m_hWnd, hMenu, uItemHilite, uHilite); }
#endif

inline BOOL CeBaseWnd::DrawMenuBar()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::DrawMenuBar(m_hWnd); }

#ifndef _WIN32_WCE
#endif

// Window Size and Position Functions

#ifndef _WIN32_WCE
inline BOOL CeBaseWnd::IsIconic() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::IsIconic(m_hWnd); }
inline BOOL CeBaseWnd::IsZoomed() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::IsZoomed(m_hWnd); }
#endif

inline BOOL CeBaseWnd::MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::MoveWindow(m_hWnd, x, y, nWidth, nHeight, bRepaint); }
inline BOOL CeBaseWnd::MoveWindow(LPCRECT lpRect, BOOL bRepaint)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::MoveWindow(m_hWnd, lpRect->left, lpRect->top, lpRect->right - lpRect->left, lpRect->bottom - lpRect->top, bRepaint); }
inline BOOL CeBaseWnd::SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetWindowPos(m_hWnd, hWndInsertAfter, x, y, cx, cy, nFlags); }
inline BOOL CeBaseWnd::SetWindowPos(HWND hWndInsertAfter, LPCRECT lpRect, UINT nFlags)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetWindowPos(m_hWnd, hWndInsertAfter, lpRect->left, lpRect->top, lpRect->right - lpRect->left, lpRect->bottom - lpRect->top, nFlags); }

#ifndef _WIN32_WCE
inline UINT CeBaseWnd::ArrangeIconicWindows()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ArrangeIconicWindows(m_hWnd); }
#endif

inline BOOL CeBaseWnd::BringWindowToTop()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::BringWindowToTop(m_hWnd); }
inline BOOL CeBaseWnd::GetWindowRect(LPRECT lpRect) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetWindowRect(m_hWnd, lpRect); }
inline BOOL CeBaseWnd::GetClientRect(LPRECT lpRect) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetClientRect(m_hWnd, lpRect); }

#ifndef _WIN32_WCE
inline BOOL CeBaseWnd::GetWindowPlacement(WINDOWPLACEMENT FAR* lpwndpl) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetWindowPlacement(m_hWnd, lpwndpl); }
inline BOOL CeBaseWnd::SetWindowPlacement(const WINDOWPLACEMENT FAR* lpwndpl)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetWindowPlacement(m_hWnd, lpwndpl); }
#endif

// Coordinate Mapping Functions

inline BOOL CeBaseWnd::ClientToScreen(LPPOINT lpPoint) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ClientToScreen(m_hWnd, lpPoint); }
inline BOOL CeBaseWnd::ClientToScreen(LPRECT lpRect) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); if(!::ClientToScreen(m_hWnd, (LPPOINT)lpRect)) return FALSE; return ::ClientToScreen(m_hWnd, ((LPPOINT)lpRect)+1); }
inline BOOL CeBaseWnd::ScreenToClient(LPPOINT lpPoint) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ScreenToClient(m_hWnd, lpPoint); }
inline BOOL CeBaseWnd::ScreenToClient(LPRECT lpRect) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); if(!::ScreenToClient(m_hWnd, (LPPOINT)lpRect)) return FALSE; return ::ScreenToClient(m_hWnd, ((LPPOINT)lpRect)+1); }
inline int CeBaseWnd::MapWindowPoints(HWND hWndTo, LPPOINT lpPoint, UINT nCount) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::MapWindowPoints(m_hWnd, hWndTo, lpPoint, nCount); }
inline int CeBaseWnd::MapWindowPoints(HWND hWndTo, LPRECT lpRect) const
	{ CHW_ASSERT(::IsWindow(m_hWnd));	return ::MapWindowPoints(m_hWnd, hWndTo, (LPPOINT)lpRect, 2); }

// Update and Painting Functions

inline HDC CeBaseWnd::BeginPaint(LPPAINTSTRUCT lpPaint)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::BeginPaint(m_hWnd, lpPaint); }
inline void CeBaseWnd::EndPaint(LPPAINTSTRUCT lpPaint)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); ::EndPaint(m_hWnd, lpPaint); }
inline HDC CeBaseWnd::GetDC()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetDC(m_hWnd); }
inline HDC CeBaseWnd::GetWindowDC()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetWindowDC(m_hWnd); }
inline int CeBaseWnd::ReleaseDC(HDC hDC)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ReleaseDC(m_hWnd, hDC); }
inline BOOL CeBaseWnd::UpdateWindow()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::UpdateWindow(m_hWnd); }
inline void CeBaseWnd::SetRedraw(BOOL bRedraw)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, WM_SETREDRAW, (WPARAM)bRedraw, 0); }
inline BOOL CeBaseWnd::GetUpdateRect(LPRECT lpRect, BOOL bErase)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetUpdateRect(m_hWnd, lpRect, bErase); }
inline int CeBaseWnd::GetUpdateRgn(HRGN hRgn, BOOL bErase)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetUpdateRgn(m_hWnd, hRgn, bErase); }
inline BOOL CeBaseWnd::Invalidate(BOOL bErase)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::InvalidateRect(m_hWnd, NULL, bErase); }
inline BOOL CeBaseWnd::InvalidateRect(LPCRECT lpRect, BOOL bErase)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::InvalidateRect(m_hWnd, lpRect, bErase); }
inline BOOL CeBaseWnd::ValidateRect(LPCRECT lpRect)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ValidateRect(m_hWnd, lpRect); }

#ifndef _WIN32_WCE
inline void CeBaseWnd::InvalidateRgn(HRGN hRgn, BOOL bErase)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); ::InvalidateRgn(m_hWnd, hRgn, bErase); }
inline BOOL CeBaseWnd::ValidateRgn(HRGN hRgn)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ValidateRgn(m_hWnd, hRgn); }
#endif

inline BOOL CeBaseWnd::ShowWindow(int nCmdShow)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ShowWindow(m_hWnd, nCmdShow); }
inline BOOL CeBaseWnd::IsWindowVisible() const
	{ return ::IsWindowVisible(m_hWnd); }

#ifndef _WIN32_WCE
inline BOOL CeBaseWnd::ShowOwnedPopups(BOOL bShow)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ShowOwnedPopups(m_hWnd, bShow); }
inline BOOL CeBaseWnd::LockWindowUpdate(BOOL bLock)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::LockWindowUpdate(bLock ? m_hWnd : NULL); }
inline BOOL CeBaseWnd::RedrawWindow(LPCRECT lpRectUpdate, HRGN hRgnUpdate, UINT flags)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::RedrawWindow(m_hWnd, lpRectUpdate, hRgnUpdate, flags); }
#endif

// Timer Functions

inline UINT CeBaseWnd::SetTimer(UINT nIDEvent, UINT nElapse)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetTimer(m_hWnd, nIDEvent, nElapse, NULL); }
inline BOOL CeBaseWnd::KillTimer(UINT nIDEvent)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::KillTimer(m_hWnd, nIDEvent); }

// Window State Functions

inline BOOL CeBaseWnd::IsWindowEnabled() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::IsWindowEnabled(m_hWnd); }
inline BOOL CeBaseWnd::EnableWindow(BOOL bEnable)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::EnableWindow(m_hWnd, bEnable); }
inline HWND CeBaseWnd::SetActiveWindow()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetActiveWindow(m_hWnd); }
inline HWND CeBaseWnd::SetCapture()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetCapture(m_hWnd); }
inline HWND CeBaseWnd::SetFocus()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetFocus(m_hWnd); }

// Dialog-Box Item Functions

inline BOOL CeBaseWnd::CheckDlgButton(int nIDButton, UINT nCheck)
#ifndef _WIN32_WCE
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::CheckDlgButton(m_hWnd, nIDButton, nCheck); }
#else
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(GetDlgItem(nIDButton), BM_SETCHECK, nCheck, 0); }
#endif

inline UINT CeBaseWnd::IsDlgButtonChecked(int nIDButton) const
	{ CHW_ASSERT(::IsWindow(m_hWnd));
	  HWND hwndCtl = ::GetDlgItem( m_hWnd, nIDButton );
	  return (UINT) Button_GetCheck( hwndCtl );
	}

inline BOOL CeBaseWnd::CheckRadioButton(int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::CheckRadioButton(m_hWnd, nIDFirstButton, nIDLastButton, nIDCheckButton); }
inline UINT CeBaseWnd::GetDlgItemInt(int nID, BOOL* lpTrans, BOOL bSigned) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetDlgItemInt(m_hWnd, nID, lpTrans, bSigned); }
inline UINT CeBaseWnd::GetDlgItemText(int nID, LPTSTR lpStr, int nMaxCount) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetDlgItemText(m_hWnd, nID, lpStr, nMaxCount); }
inline HWND CeBaseWnd::GetNextDlgGroupItem(HWND hWndCtl, BOOL bPrevious) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetNextDlgGroupItem(m_hWnd, hWndCtl, bPrevious); }
inline HWND CeBaseWnd::GetNextDlgTabItem(HWND hWndCtl, BOOL bPrevious) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetNextDlgTabItem(m_hWnd, hWndCtl, bPrevious); }
inline LRESULT CeBaseWnd::SendDlgItemMessage(int nID, UINT message, WPARAM wParam, LPARAM lParam)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SendDlgItemMessage(m_hWnd, nID, message, wParam, lParam); }
inline BOOL CeBaseWnd::SetDlgItemInt(int nID, UINT nValue, BOOL bSigned)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetDlgItemInt(m_hWnd, nID, nValue, bSigned); }
inline BOOL CeBaseWnd::SetDlgItemText(int nID, LPCTSTR lpszString)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetDlgItemText(m_hWnd, nID, lpszString); }

// Scrolling Functions

#ifndef _WIN32_WCE
inline int CeBaseWnd::GetScrollPos(int nBar) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetScrollPos(m_hWnd, nBar); }
inline BOOL CeBaseWnd::GetScrollRange(int nBar, LPINT lpMinPos, LPINT lpMaxPos) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetScrollRange(m_hWnd, nBar, lpMinPos, lpMaxPos); }
inline BOOL CeBaseWnd::ScrollWindow(int xAmount, int yAmount, LPCRECT lpRect, LPCRECT lpClipRect)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ScrollWindow(m_hWnd, xAmount, yAmount, lpRect, lpClipRect); }
//inline BOOL CeBaseWnd::ShowScrollBar(UINT nBar, BOOL bShow)
//	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ShowScrollBar(m_hWnd, nBar, bShow); }
inline BOOL CeBaseWnd::EnableScrollBar(UINT uSBFlags, UINT uArrowFlags)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::EnableScrollBar(m_hWnd, uSBFlags, uArrowFlags); }
#endif

inline int CeBaseWnd::ScrollWindowEx(int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate, UINT uFlags)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ScrollWindowEx(m_hWnd, dx, dy, lpRectScroll, lpRectClip, hRgnUpdate, lpRectUpdate, uFlags); }
inline int CeBaseWnd::ScrollWindowEx(int dx, int dy, UINT uFlags, LPCRECT lpRectScroll, LPCRECT lpRectClip, HRGN hRgnUpdate, LPRECT lpRectUpdate)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ScrollWindowEx(m_hWnd, dx, dy, lpRectScroll, lpRectClip, hRgnUpdate, lpRectUpdate, uFlags); }
inline int CeBaseWnd::SetScrollPos(int nBar, int nPos, BOOL bRedraw)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetScrollPos(m_hWnd, nBar, nPos, bRedraw); }
inline BOOL CeBaseWnd::SetScrollRange(int nBar, int nMinPos, int nMaxPos, BOOL bRedraw)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetScrollRange(m_hWnd, nBar, nMinPos, nMaxPos, bRedraw); }

// Window Access Functions

inline HWND CeBaseWnd::ChildWindowFromPoint(POINT point) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ChildWindowFromPoint(m_hWnd, point); }

#ifndef _WIN32_WCE
inline HWND CeBaseWnd::ChildWindowFromPointEx(POINT point, UINT uFlags) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ChildWindowFromPointEx(m_hWnd, point, uFlags); }
inline HWND CeBaseWnd::GetTopWindow() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetTopWindow(m_hWnd); }
inline HWND CeBaseWnd::GetLastActivePopup() const
{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetLastActivePopup(m_hWnd); }
#endif

inline HWND CeBaseWnd::GetWindow(UINT nCmd) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetWindow(m_hWnd, nCmd); }
inline BOOL CeBaseWnd::IsChild(HWND hWnd) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::IsChild(m_hWnd, hWnd); }
inline HWND CeBaseWnd::GetParent() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetParent(m_hWnd); }
inline HWND CeBaseWnd::SetParent(HWND hWndNewParent)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetParent(m_hWnd, hWndNewParent); }

inline HWND CeBaseWnd::GetTopLevelWindow() const
	{ return GetTopLevelWindow(m_hWnd); }
inline HWND CeBaseWnd::GetTopLevelWindow(HWND hWnd)
	{ CHW_ASSERT(::IsWindow(hWnd));
		HWND hWndParent;
		HWND hWndTmp = hWnd;
		do {
			hWndParent = hWndTmp;
			hWndTmp = (::GetWindowLong(hWndParent, GWL_STYLE) & WS_CHILD) ? ::GetParent(hWndParent) : ::GetWindow(hWndParent, GW_OWNER);
		} while(hWndTmp != NULL);
		return hWndParent;
	}

// Window Tree Access

inline int CeBaseWnd::GetDlgCtrlID() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetDlgCtrlID(m_hWnd); }
inline int CeBaseWnd::SetDlgCtrlID(int nID)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return (int)::SetWindowLong(m_hWnd, GWL_ID, nID); }
inline HWND CeBaseWnd::GetDlgItem(int nID) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetDlgItem(m_hWnd, nID); }

// Alert Functions

#ifndef _WIN32_WCE
inline BOOL CeBaseWnd::FlashWindow(BOOL bInvert)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::FlashWindow(m_hWnd, bInvert); }
#endif

inline int CeBaseWnd::MessageBox(LPCTSTR lpszText, LPCTSTR lpszCaption, UINT nType)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::MessageBox(m_hWnd, lpszText, lpszCaption, nType); }

// Clipboard Functions

#ifndef _WIN32_WCE
inline BOOL CeBaseWnd::ChangeClipboardChain(HWND hWndNewNext)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ChangeClipboardChain(m_hWnd, hWndNewNext); }
inline HWND CeBaseWnd::SetClipboardViewer()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetClipboardViewer(m_hWnd); }
#endif
inline BOOL CeBaseWnd::OpenClipboard()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::OpenClipboard(m_hWnd); }

// Caret Functions

inline BOOL CeBaseWnd::CreateCaret(HBITMAP hBitmap)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::CreateCaret(m_hWnd, hBitmap, 0, 0); }
inline BOOL CeBaseWnd::CreateSolidCaret(int nWidth, int nHeight)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::CreateCaret(m_hWnd, (HBITMAP)0, nWidth, nHeight); }
inline BOOL CeBaseWnd::CreateGrayCaret(int nWidth, int nHeight)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::CreateCaret(m_hWnd, (HBITMAP)1, nWidth, nHeight); }
inline BOOL CeBaseWnd::HideCaret()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::HideCaret(m_hWnd); }
inline BOOL CeBaseWnd::ShowCaret()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ShowCaret(m_hWnd); }

#if defined(_INC_SHELLAPI) && !defined(_WIN32_WCE)
// Drag-Drop Functions
inline void CeBaseWnd::DragAcceptFiles(BOOL bAccept)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); ::DragAcceptFiles(m_hWnd, bAccept); }
#endif

// Icon Functions

inline HICON CeBaseWnd::SetIcon(HICON hIcon, BOOL bBigIcon)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return (HICON)::SendMessage(m_hWnd, WM_SETICON, bBigIcon, (LPARAM)hIcon); }
inline HICON CeBaseWnd::GetIcon(BOOL bBigIcon) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return (HICON)::SendMessage(m_hWnd, WM_GETICON, bBigIcon, 0); }

// Help Functions

#ifndef _WIN32_WCE
inline BOOL CeBaseWnd::WinHelp(LPCTSTR lpszHelp, UINT nCmd, DWORD dwData)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::WinHelp(m_hWnd, lpszHelp, nCmd, dwData); }
inline BOOL CeBaseWnd::SetWindowContextHelpId(DWORD dwContextHelpId)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetWindowContextHelpId(m_hWnd, dwContextHelpId); }
inline DWORD CeBaseWnd::GetWindowContextHelpId() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetWindowContextHelpId(m_hWnd); }
#endif

// Hot Key Functions

#ifndef _WIN32_WCE
inline int CeBaseWnd::SetHotKey(WORD wVirtualKeyCode, WORD wModifiers)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, WM_SETHOTKEY, MAKEWORD(wVirtualKeyCode, wModifiers), 0); }
inline DWORD CeBaseWnd::GetHotKey() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SendMessage(m_hWnd, WM_GETHOTKEY, 0, 0); }
#endif

// Misc. Operations

//N new
inline BOOL CeBaseWnd::GetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetScrollInfo(m_hWnd, nBar, lpScrollInfo); }
inline BOOL CeBaseWnd::SetScrollInfo(int nBar, LPSCROLLINFO lpScrollInfo, BOOL bRedraw)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetScrollInfo(m_hWnd, nBar, lpScrollInfo, bRedraw); }
inline BOOL CeBaseWnd::IsDialogMessage(LPMSG lpMsg)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::IsDialogMessage(m_hWnd, lpMsg); }
inline void CeBaseWnd::NextDlgCtrl() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, WM_NEXTDLGCTL, 0, 0L); }
inline void CeBaseWnd::PrevDlgCtrl() const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, WM_NEXTDLGCTL, 1, 0L); }
inline void CeBaseWnd::GotoDlgCtrl(HWND hWndCtrl) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, WM_NEXTDLGCTL, (WPARAM)hWndCtrl, 1L); }
#ifndef _WIN32_WCE
inline int CeBaseWnd::GetWindowRgn(HRGN hRgn) const
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetWindowRgn(m_hWnd, hRgn); }
inline int CeBaseWnd::SetWindowRgn(HRGN hRgn, BOOL bRedraw)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::SetWindowRgn(m_hWnd, hRgn, bRedraw); }
inline HDWP CeBaseWnd::DeferWindowPos(HDWP hWinPosInfo, HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT uFlags)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::DeferWindowPos(hWinPosInfo, m_hWnd, hWndInsertAfter, x, y, cx, cy, uFlags); }
#endif
inline DWORD CeBaseWnd::GetWindowThreadID()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::GetWindowThreadProcessId(m_hWnd, NULL); }
inline DWORD CeBaseWnd::GetWindowProcessID()
	{ CHW_ASSERT(::IsWindow(m_hWnd)); DWORD dwProcessID; ::GetWindowThreadProcessId(m_hWnd, &dwProcessID); return dwProcessID; }
inline BOOL CeBaseWnd::IsWindow() const
	{ return ::IsWindow(m_hWnd); }
inline BOOL CeBaseWnd::IsWindowUnicode() const
#ifndef _WIN32_WCE
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::IsWindowUnicode(m_hWnd); }
#else
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return TRUE; }
#endif
inline BOOL CeBaseWnd::IsParentDialog() const
{
	CHW_ASSERT(::IsWindow(m_hWnd)); TCHAR szBuf[8]; // "#32770" + NUL character
	GetClassName(GetParent(), szBuf, sizeof(szBuf)/sizeof(TCHAR));
	return lstrcmp(szBuf, _T("#32770")) == 0;
}

#ifndef _WIN32_WCE
inline BOOL CeBaseWnd::ShowWindowAsync(int nCmdShow)
	{ CHW_ASSERT(::IsWindow(m_hWnd)); return ::ShowWindowAsync(m_hWnd, nCmdShow); }
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions