⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 baselistctrl.cpp

📁 基于WINDOWS mobile 的用于创建一个窗体和自定义试图的工程
💻 CPP
字号:
// BaseListCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "BaseListCtrl.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


//---------------------------------------------------------------------------
//
//	CBaseListCtrl
//
//---------------------------------------------------------------------------


CBaseListCtrl::CBaseListCtrl()
:	m_bAPI	(FALSE)
{
}


CBaseListCtrl::~CBaseListCtrl()
{
}


BEGIN_MESSAGE_MAP(CBaseListCtrl, CListCtrl)
	//{{AFX_MSG_MAP(CBaseListCtrl)
	ON_WM_LBUTTONDOWN()
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


//---------------------------------------------------------------------------
//
//	CBaseListCtrl operations
//
//---------------------------------------------------------------------------


// CBaseListCtrl::Create
//
//		Creates a normal child list control
//
BOOL CBaseListCtrl::Create(DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, UINT nID)
{
	HWND			hWnd = NULL;
	CREATESTRUCT	cs;
	CRect			rc(rect);

	//
	// Prepare the create structure
	//
	cs.hwndParent		= pParentWnd->GetSafeHwnd();
	cs.lpszName			= NULL;
	cs.x				= 0;
	cs.y				= 0;
	cs.cx				= rc.Width();
	cs.cy				= rc.Height();
	cs.hInstance		= AfxGetInstanceHandle();
	cs.dwExStyle		= 0;
	cs.style			= dwStyle;
	cs.hMenu			= (HMENU) nID;
	cs.lpszClass		= WC_LISTVIEW;
	cs.lpCreateParams	= NULL;

	if(PreCreateWindow(cs))
	{
		hWnd = ::CreateWindowEx(cs.dwExStyle, cs.lpszClass, cs.lpszName, 
								cs.style, cs.x, cs.y, cs.cx, cs.cy, 
								cs.hwndParent, cs.hMenu, cs.hInstance, 
								cs.lpCreateParams);
		if(hWnd)
		{
			if(SubclassWindow(hWnd))
			{
				PostCreateWindow(cs);
				m_bAPI = TRUE;
			}
		}
	}

	return hWnd != NULL;
}

/*
// CBaseListCtrl::CreateListMenu
//
//		Creates the list menu window
//
BOOL CBaseListCtrl::Create(DWORD dwStyle, LPCTSTR pszTitle, CMultiFrameWnd *pFrameWnd)
{
	CRect	rc;
	BOOL	bOk	= FALSE;

	ASSERT(pFrameWnd);

	pFrameWnd->GetClientRect(&rc);

	bOk = Create(dwStyle, rc, pFrameWnd, AFX_IDW_PANE_FIRST);
	if(bOk)
		SetWindowText(pszTitle);

	return bOk;
}
*/

//---------------------------------------------------------------------------
//
//	CBaseListCtrl virtual methods
//
//---------------------------------------------------------------------------


// CBaseListCtrl::DestroyWindow
//
//		Special process for destroying the list control
//
BOOL CBaseListCtrl::DestroyWindow() 
{
	BOOL	bRval;

	if(m_bAPI)
	{
		HWND	hWnd;

		hWnd = UnsubclassWindow();
		bRval = ::DestroyWindow(hWnd);
	}
	else
		bRval = CListCtrl::DestroyWindow();
	return bRval;
}


// CBaseListCtrl::PreCreateWindow
//
//		Called before the window is created
//
BOOL CBaseListCtrl::PreCreateWindow(CREATESTRUCT& cs) 
{
	return TRUE;
}


// CBaseListCtrl::PostCreateWindow
//
//		Called after the API Create succeeds
//
void CBaseListCtrl::PostCreateWindow(CREATESTRUCT &cs)
{
}


//---------------------------------------------------------------------------
//
//	CBaseListCtrl message handlers
//
//---------------------------------------------------------------------------


// CBaseListCtrl::OnLButtonDown
//
//		Avoid having MFC handle tap-and-hold
//
void CBaseListCtrl::OnLButtonDown(UINT nFlags, CPoint point) 
{
	Default();
}


// CBaseListCtrl::OnDestroy
//
//		The list control is being destroyed
//
void CBaseListCtrl::OnDestroy() 
{
	CListCtrl::OnDestroy();

	if(m_bAPI)
		UnsubclassWindow();
}

⌨️ 快捷键说明

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