cmsgreceiver.cpp

来自「VC vod源码 放出来供大家交流学习」· C++ 代码 · 共 68 行

CPP
68
字号
//
// CMsgReceiver.h
//

/*-----------------------------------------------------*\
			HQ Tech, Make Technology Easy!       
 More information, please go to http://hqtech.nease.net.
/*-----------------------------------------------------*/

#include "stdafx.h"
#include "CMsgReceiver.h"

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

CMsgReceiver::CMsgReceiver(void)
{
}

CMsgReceiver::~CMsgReceiver(void)
{
	for (int i = mStations.GetSize() - 1; i >= 0; i --)
	{
		CMsgStation * station = (CMsgStation *) mStations.GetAt(i);
		if (station)
		{
			station->RemoveMsgReceiver(this);
		}
	}
}

void CMsgReceiver::AddMsgStation(CMsgStation * inStation)
{
	mStations.Add(inStation);
}

void CMsgReceiver::RemoveMsgStation(CMsgStation * inStation)
{
	mStations.Remove(inStation);
}

bool CMsgReceiver::ReceiveMessage(MessageT inMessage, void * ioParam, void * ioParam2)
{
	switch (inMessage)
	{
	case msg_Notify:
		{
			SNotificationStruct * notification = (SNotificationStruct *)ioParam;
			return Respond(notification->mNotification, notification->mStation,
				notification->mParam1, notification->mParam2);
		}

	case msg_StationDestroyed:
		RemoveMsgStation((CMsgStation *)ioParam);
		return true;
	}
	return false;
}

bool CMsgReceiver::Respond(NotifyT inNotification, CMsgStation * inStation,
						long inParam1, long inParam2)
{
	return false;
}

⌨️ 快捷键说明

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