xwndmultipleinheritance.h

来自「Visual_C++[1].NET_Bible1 Visual_C++宝典书中」· C头文件 代码 · 共 52 行

H
52
字号
// XWndMultipleInheritance.h : header file
//

#ifndef _XWNDMULTIPLEINHERITANCE_
#define _XWNDMULTIPLEINHERITANCE_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CXWndMultipleInheritance {
	// Construction
public:
	CXWndMultipleInheritance(CWnd* pWnd) : m_pWnd(pWnd) {}
	// Casting operators etc
public:
	operator CWnd&() { return *m_pWnd; }
	operator const CWnd&() const { return *m_pWnd; }
	operator CWnd*() { return m_pWnd; }
	operator const CWnd*() const { return m_pWnd; }
	CWnd* operator->() { return m_pWnd; }
	const CWnd* operator->() const { return m_pWnd; }
	// Encapsulate some common calls (add to this later if required)
public:
	LRESULT CWnd_SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 ) {
		return (*this)->SendMessage(message,wParam,lParam);
	}
	LRESULT CWnd_PostMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 ) {
		return (*this)->PostMessage(message,wParam,lParam);
	}
	HWND CWnd_GetSafeHwnd() const {
		return (*this)->GetSafeHwnd();
	}
	void CWnd_ScreenToClient(LPPOINT lpPoint) const {
		(*this)->ScreenToClient(lpPoint);
	}
	void CWnd_ScreenToClient(LPRECT lpRect) const {
		(*this)->ScreenToClient(lpRect);
	}
	void CWnd_ClientToScreen(LPPOINT lpPoint) const {
		(*this)->ClientToScreen(lpPoint);
	}
	void CWnd_ClientToScreen(LPRECT lpRect) const {
		(*this)->ClientToScreen(lpRect);
	}
	// the pointer to the actuall window
private:
	CWnd* m_pWnd;
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?