Click here to Skip to main content
12,454,164 members (56,392 online)
Click here to Skip to main content

Stats

46.6K views
978 downloads
33 bookmarked
Posted

Notifying the Document

, 12 Jul 2006 CPOL
An article on delivering objects to the document in a document/view architecture, using the WM_NOTIFY message.
// NotifyObject.cpp : implementation file
//

#include "stdafx.h"
#include "NotifierApp.h"
#include "NotifyObject.h"


// CNotifyObject
IMPLEMENT_SERIAL(CNotifyObject, CObject, NOTIFY_OBJECT_SCHEMA ) 

CNotifyObject::CNotifyObject()
{
	memset( &(m_hdrObject.nmHdr), 0, sizeof(m_hdrObject.nmHdr) ) ;
	m_hdrObject.pObject = this ;
	m_Message = 0 ;
}

CNotifyObject::CNotifyObject( NMHDR & Hdr )
{
	memcpy( &(m_hdrObject.nmHdr), &(Hdr), sizeof(m_hdrObject.nmHdr) ) ;
	m_hdrObject.pObject = this ;
	m_Message = 0 ;
}

CNotifyObject::CNotifyObject( const CNotifyObject & Object )
{
	Copy( Object ) ;
	m_hdrObject.pObject = this ;
}

CNotifyObject::~CNotifyObject()
{
}


// CNotifyObject member functions
UINT CNotifyObject::get_Message()
{
	return m_Message ; 
}

CNotifyObject & CNotifyObject::operator = ( const CNotifyObject & Object )
{
	Copy( Object ) ;
	m_hdrObject.pObject = this ;
	return *this  ;
}

void CNotifyObject::Copy( const CNotifyObject & Object )
{
	memcpy( &(m_hdrObject.nmHdr), &(const_cast<CNotifyObject &>(Object).m_hdrObject.nmHdr), sizeof(m_hdrObject.nmHdr) ) ;
	m_Message = const_cast<CNotifyObject&>(Object).m_Message ;
}


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)

Share

About the Author

Michael Bergman
Software Developer (Senior)
United States United States
No Biography provided

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160826.1 | Last Updated 12 Jul 2006
Article Copyright 2006 by Michael Bergman
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid