Click here to Skip to main content
15,886,724 members
Articles / Desktop Programming / MFC

Notifying the Document

Rate me:
Please Sign up or sign in to vote.
4.36/5 (11 votes)
12 Jul 2006CPOL6 min read 63.5K   1.2K   35  
An article on delivering objects to the document in a document/view architecture, using the WM_NOTIFY message.
#pragma once

#define NOTIFY_ERROR_SCHEMA 100 


class CErrorObject : public CNotifyObject
{
	DECLARE_SERIAL(CErrorObject) 
protected:
	CErrorObject() {}
public:
	CErrorObject( UINT Message, LPCTSTR ErrorMessage, NMHDR & Hdr );
	CErrorObject( const CErrorObject & Object );
	virtual ~CErrorObject(void);

	CErrorObject & operator = ( const CErrorObject & Object ) ;

	LPCTSTR get_ErrorMessage() ; 

protected:
	void Copy( const CErrorObject & Object ) ; 

protected:
	CString m_ErrorMessage ; 


};

#define NOTIFY_INFORMATION_SCHEMA 100 


class CInformationObject : public CNotifyObject
{
	DECLARE_SERIAL(CInformationObject) 
protected:
	CInformationObject() {}
public:
	CInformationObject( UINT Message, LPCTSTR InformationMessage, NMHDR & Hdr );
	CInformationObject( const CInformationObject & Object );
	virtual ~CInformationObject(void);

	CInformationObject & operator = ( const CInformationObject & Object ) ;

	LPCTSTR get_InformationMessage() ; 

protected:
	void Copy( const CInformationObject & Object ) ; 

protected:
	CString m_InformationMessage ; 


};


enum
{
	NOTIFY_INVALID_OBJECT=-1,
	NOTIFY_ERROR_OBJECT=0,
	NOTIFY_INFORMATION_OBJECT,
	NOTIFY_OBJECT_COUNT
} ;

class NotifyObjectType
{
public:
	NotifyObjectType( CNotifyObject * pObject ) ;
	operator long() ; 
protected:
	long m_Type ; 
} ;


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
Software Developer (Senior)
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