www.pudn.com > VCListCtrl.rar > ListCtrlDemo.cpp


// ListCtrlDemo.cpp : Defines the class behaviors for the application. 
// 
// Written by matt weagle (matt_weagle@hotmail.com) 
// Copyright (c) 2000. 
// 
// 
// This code may be used in compiled form in any way you desire. This 
// file may be redistributed unmodified by any means PROVIDING it is  
// not sold for profit without the authors written consent, and  
// providing that this notice and the authors name is included. If  
// the source code in  this file is used in any commercial application  
// then a simple email would be nice. 
// 
// This file is provided "as is" with no expressed or implied warranty. 
// The author accepts no liability if it causes any damage whatsoever. 
// Consider yourself lucky if it works, unlucky if it doesn't. 
// 
// Thanks to Chris Maunder (chris@codeproject.com) for the  
// foregoing disclaimer. 
//  
// Please use and enjoy. Please let me know of any bugs/mods/improvements  
// that you have found/implemented and I will fix/incorporate them into this 
// file.  
// 
#include "stdafx.h" 
#include "ListCtrlDemo.h" 
#include "ListCtrlDemoDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CListCtrlDemoApp 
 
BEGIN_MESSAGE_MAP(CListCtrlDemoApp, CWinApp) 
	//{{AFX_MSG_MAP(CListCtrlDemoApp) 
		// NOTE - the ClassWizard will add and remove mapping macros here. 
		//    DO NOT EDIT what you see in these blocks of generated code! 
	//}}AFX_MSG 
	ON_COMMAND(ID_HELP, CWinApp::OnHelp) 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CListCtrlDemoApp construction 
 
CListCtrlDemoApp::CListCtrlDemoApp() 
{ 
	// TODO: add construction code here, 
	// Place all significant initialization in InitInstance 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// The one and only CListCtrlDemoApp object 
 
CListCtrlDemoApp theApp; 
 
///////////////////////////////////////////////////////////////////////////// 
// CListCtrlDemoApp initialization 
 
BOOL CListCtrlDemoApp::InitInstance() 
{ 
//	AfxEnableControlContainer(); 
 
	// Standard initialization 
	// If you are not using these features and wish to reduce the size 
	//  of your final executable, you should remove from the following 
	//  the specific initialization routines you do not need. 
 
#ifdef _AFXDLL 
	Enable3dControls();			// Call this when using MFC in a shared DLL 
#else 
	Enable3dControlsStatic();	// Call this when linking to MFC statically 
#endif 
 
	// We need to init COM in order to show an image in the  
	// list control 
	if (!AfxOleInit()) 
	{ 
		AfxMessageBox("Unable to initialize OLE.\nTerminating application!"); 
		return FALSE; 
	} 
 
 
	// Then shown the dialog 
	CListCtrlDemoDlg dlg; 
	m_pMainWnd = &dlg; 
	int nResponse = dlg.DoModal(); 
	if (nResponse == IDOK) 
	{ 
		// TODO: Place code here to handle when the dialog is 
		//  dismissed with OK 
	} 
	else if (nResponse == IDCANCEL) 
	{ 
		// TODO: Place code here to handle when the dialog is 
		//  dismissed with Cancel 
	} 
 
	// Since the dialog has been closed, return FALSE so that we exit the 
	//  application, rather than start the application's message pump. 
	return FALSE; 
}