Skip to main content
gamedev.net
🔒 Locked

MFC Message Map Problem

Started by Scar 0 replies 250+ views
Original Post
Scar
Scar
For some reason, the compiler is giving me an error when I try to use a custom message. Here's the problem:

error C2440: 'static_cast' : cannot convert from 'void (__thiscall CStageZeroNetworkAnalysisView::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
And how I implemented it:

//////// View.h
afx_msg void OnNewPacket(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()


//////// View.cpp
BEGIN_MESSAGE_MAP(CStageZeroNetworkAnalysisView, CView)

	ON_MESSAGE(MSG_NEW_PACKET, OnNewPacket)
END_MESSAGE_MAP()


///////// The function
void CStageZeroNetworkAnalysisView::OnNewPacket(WPARAM wParam, LPARAM lParam)
{
	ZeroPacket* ZP = new ZeroPacket();
	ZP->SetData((pcap_pkthdr*)wParam, (u_char*)lParam);
	ZP->Serialize(ZData);
}
Any help will be much appreciated. Thanks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.