Click here to Skip to main content
15,915,805 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Crash ribbon when PC enter in sleep/standby mode Pin
Eugen Podsypalnikov1-Sep-10 22:34
Eugen Podsypalnikov1-Sep-10 22:34 
GeneralRe: Crash ribbon when PC enter in sleep/standby mode Pin
Dansveen2-Sep-10 3:09
Dansveen2-Sep-10 3:09 
GeneralRe: Crash ribbon when PC enter in sleep/standby mode Pin
Eugen Podsypalnikov2-Sep-10 3:22
Eugen Podsypalnikov2-Sep-10 3:22 
GeneralRe: Crash ribbon when PC enter in sleep/standby mode Pin
Dansveen2-Sep-10 9:11
Dansveen2-Sep-10 9:11 
GeneralRe: Crash ribbon when PC enter in sleep/standby mode Pin
Eugen Podsypalnikov2-Sep-10 20:55
Eugen Podsypalnikov2-Sep-10 20:55 
QuestionCan we create DSN name and set a path through Install shield Pin
raju_shiva30-Aug-10 20:48
raju_shiva30-Aug-10 20:48 
QuestionRe: Can we create DSN name and set a path through Install shield Pin
David Crow31-Aug-10 5:45
David Crow31-Aug-10 5:45 
QuestionCustomized BEGIN_TEMPLATE_MESSAGE_MAP with 2 template arguments for VS2005 Pin
funwithdolphin30-Aug-10 19:50
funwithdolphin30-Aug-10 19:50 
Hi, I am getting below compiler error on Visual Studio 2005:
isodirbrowserlistctrl.cpp(46) : error C2906: 'const AFX_MSGMAP *CListDataCtrl<B,T>::GetThisMessageMap(void)' : explicit specialization requires 'template <>' with [B=CListCtrl,T=CBrowserListCtrlData

Here is the code with .h and .cpp files. This code used to compile and run fine on Visual Studio 6.0. I guess I need to use BEGIN_TEMPLATE_MESSAGE_MAP. But BEGIN_TEMPLATE_MESSAGE_MAP can not handle more than one template arguments. In my case, there are 2 template arguments.

// ListDataCtrl.h : header file
//
class CListDataBase 
{
public:
	CListDataBase() : m_iItem(-1), m_pCtl(0) {};
	void SetControl(CListCtrl* pCtl) { m_pCtl = pCtl; }
	CListCtrl* GetControl() { return m_pCtl; }
	void SetItemNumber(int iItem) { m_iItem = iItem; }
	int GetItemNumber() { return m_iItem; }

protected:
	int m_iItem;
	CListCtrl *m_pCtl;
};
////////////////////////////////////////////////////////////////////////////
// CListDataCtrl window

template <class B, class T>
class CListDataCtrl : public B
{
// Construction
public:
	CListDataCtrl() {};
// Attributes
public:
// Operations
public:
	T* GetListData(int iItem)
	{
		T *pResult = (T*) GetItemData(iItem);	
		return pResult;
	}

	void DeleteListDataPrim(int iItem)
	{
		T* pData = (T*) GetItemData(iItem);
		delete pData; pData = 0;
		SetItemData(iItem, 0);
	}

	void DeleteListData(int iItem)
	{
		DeleteListDataPrim(iItem); 
	}

	BOOL DeleteListNode(int iItem)
	{
		DeleteListData(iItem);
		return DeleteItem(iItem);
	}
	void SetListData(int iItem, T* pData)
	{
		pData->SetItemNumber(iItem);
		pData->SetControl(this);
		DeleteListData(iItem);
		SetItemData(iItem, (DWORD) pData);
	}

	void DeleteAllListData()
	{
		int cMax = GetItemCount();
		for (int i=0; i<cMax; i++)
		{
			delete (T*) GetItemData(i);
			SetItemData(i, 0);
		}
	}

	void DeleteEntireList()
	{
		DeleteAllListData();
		DeleteAllItems();
	}

	T* InsertItemData(LPCTSTR ptszText, int iItem, T* pData = 0)
	{
		if (!pData)
		{
			pData = new T;
		}
		int iNewItem = InsertItem(iItem, ptszText);
		SetListData(iNewItem, pData);
		return pData;
	}

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CListDataCtrl)
	//}}AFX_VIRTUAL
// Implementation
public:
	virtual ~CListDataCtrl() {};
	// Generated message map functions
protected:
	//{{AFX_MSG(CListDataCtrl)
		// NOTE - the ClassWizard will add and remove member functions here.
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_LISTDATACTRL_H__D2FAE7C7_4E4E_11D2_BA1B_00A02489AC7A__INCLUDED_)
 

// IsoDirBrowserListCtrl.h : header file
//
#include "ListDataCtrl.h"
#include "DirectoryInfo.h"
#include "DirDn.h"

class CBrowserListCtrlData : CListDataBase 
{
public:
	CDirDn m_rdnEntry;
	CDirectoryInfo* m_pDirInfo;
	HTREEITEM hTreeParent;
	CString m_csFullDn;
};

typedef CListDataCtrl<CListCtrl,CBrowserListCtrlData> CIsoDirBrowserListCtrlBase;
class CIsoDirBrowserListCtrl : public CIsoDirBrowserListCtrlBase
{
// Construction
public:
	CIsoDirBrowserListCtrl();
// Attributes
public:
// Operations
public:
public:
	virtual ~CIsoDirBrowserListCtrl();
protected:
	DECLARE_MESSAGE_MAP()
};

<pre lang="x-cpp">// IsoDirBrowserListCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "isodirbrowser.h"
#include "IsoDirBrowserListCtrl.h"

// IsoDirBrowserListCtrl.cpp : CPP file
//

CIsoDirBrowserListCtrl::CIsoDirBrowserListCtrl()
{
}

CIsoDirBrowserListCtrl::~CIsoDirBrowserListCtrl()
{
}

BEGIN_MESSAGE_MAP(CIsoDirBrowserListCtrlBase, CListCtrl)
	//{{AFX_MSG_MAP(CListDataCtrl)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_MESSAGE_MAP(CIsoDirBrowserListCtrl, CIsoDirBrowserListCtrlBase)
	//{{AFX_MSG_MAP(CIsoDirBrowserListCtrl)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CIsoDirBrowserListCtrl message handlers


Here is the code with .h and .cpp files. This code used to compile and run fine on Visual Studio 6.0. I guess I need to use BEGIN_TEMPLATE_MESSAGE_MAP.But I can't use BEGIN_TEMPLATE_MESSAGE_MAP because it works only when there is single template argument. In my case, I have 2 template arguments.

#define BEGIN_TEMPLATE_MESSAGE_MAP(theClass, type_name, baseClass)  \
 PTM_WARNING_DISABLE       \
 template < typename type_name >      \
 const AFX_MSGMAP* theClass< type_name >::GetMessageMap() const  \
 { return GetThisMessageMap(); }     \
 template < typename type_name >      \
 const AFX_MSGMAP* PASCAL theClass< type_name >::GetThisMessageMap() \
 {         \
 typedef theClass< type_name > ThisClass;    \
 typedef baseClass TheBaseClass;     \
 static const AFX_MSGMAP_ENTRY _messageEntries[] =   \
 {


Can above BEGIN_TEMPLATE_MESSAGE_MAP be changed to cater for 2 template arguments. I mean can I have BEGIN_TEMPLATE_MESSAGE_MAP_2 for 2 template arguments? Can someone tell me what will have to be written in BEGIN_TEMPLATE_MESSAGE_MAP_2 macro to handle 2 template arguments for VS2005?

PLEASE NOTE that I need to have BEGIN_TEMPLATE_MESSAGE_MAP_2 for Visual Studio 2005. Please help.
AnswerRe: Customized BEGIN_TEMPLATE_MESSAGE_MAP with 2 template arguments for VS2005 Pin
Code-o-mat30-Aug-10 22:29
Code-o-mat30-Aug-10 22:29 
GeneralRe: Customized BEGIN_TEMPLATE_MESSAGE_MAP with 2 template arguments for VS2005 Pin
funwithdolphin30-Aug-10 23:30
funwithdolphin30-Aug-10 23:30 
GeneralRe: Customized BEGIN_TEMPLATE_MESSAGE_MAP with 2 template arguments for VS2005 Pin
Code-o-mat31-Aug-10 0:01
Code-o-mat31-Aug-10 0:01 
QuestionCopy and Cast a List Pin
Skippums30-Aug-10 15:02
Skippums30-Aug-10 15:02 
AnswerRe: Copy and Cast a List Pin
Sameerkumar Namdeo30-Aug-10 18:40
Sameerkumar Namdeo30-Aug-10 18:40 
AnswerRe: Copy and Cast a List Pin
Paul Michalik30-Aug-10 21:10
Paul Michalik30-Aug-10 21:10 
QuestionDLL Hook - Get Host Process ID Pin
Joe_Dert30-Aug-10 14:13
Joe_Dert30-Aug-10 14:13 
AnswerRe: DLL Hook - Get Host Process ID PinPopular
«_Superman_»30-Aug-10 20:24
professional«_Superman_»30-Aug-10 20:24 
GeneralRe: DLL Hook - Get Host Process ID Pin
Joe_Dert31-Aug-10 0:06
Joe_Dert31-Aug-10 0:06 
QuestionSTL / Custom Linked List Pin
Fareed Rizkalla30-Aug-10 11:06
Fareed Rizkalla30-Aug-10 11:06 
AnswerRe: STL / Custom Linked List Pin
Luc Pattyn30-Aug-10 11:30
sitebuilderLuc Pattyn30-Aug-10 11:30 
GeneralRe: STL / Custom Linked List Pin
Fareed Rizkalla30-Aug-10 11:55
Fareed Rizkalla30-Aug-10 11:55 
GeneralRe: STL / Custom Linked List Pin
Luc Pattyn30-Aug-10 12:11
sitebuilderLuc Pattyn30-Aug-10 12:11 
GeneralRe: STL / Custom Linked List Pin
Blake Miller3-Sep-10 12:30
Blake Miller3-Sep-10 12:30 
GeneralRe: STL / Custom Linked List Pin
Luc Pattyn3-Sep-10 14:52
sitebuilderLuc Pattyn3-Sep-10 14:52 
AnswerRe: STL / Custom Linked List Pin
Maximilien30-Aug-10 13:43
Maximilien30-Aug-10 13:43 
AnswerRe: STL / Custom Linked List Pin
Emilio Garavaglia30-Aug-10 20:04
Emilio Garavaglia30-Aug-10 20:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.