Skip to main content
GameDev.net gamedev.net
🔒 Locked

DirectPlay8 classes?

Started by wazoo69 Dec 4, 2001 at 10:18 PM 1 replies 250+ views
Original Post
wazoo69
wazoo69
Hey just wondering how many out there have successfully been using DirectPlay objects inside an OO framework... I''ve got a framework going, but I''m stuck at a problem: DirectPlay8 isn''t working so well within my classes....I''ve got the DirectPlayMessageHandler function declared as a static one, then inside that it reinterprets this into MY NetworkMessageHandler function.. Now the problem is that functions CALLED from this NetworkMessageHandler function aren''t working properly (ie. they don''t even SEE the IDirectPlay8Peer member object anymore) I''m kinda stuck and hoping someone knows wth I''m talking about and can give me a small hand.. thanks!
Shannon Barber
Shannon Barber
Hum...

  
HRESULT CNetworkServerDx8::Initialize()
{
HRESULT hr;

if(!m_pDPServer)
{
TESTHR(m_pDPServer.CoCreateInstance(CLSID_DirectPlay8Server));
TESTHR(m_pDPServer->Initialize(this, MsgProc, 0));
}
//...

if(FAILED(hr=m_pDPServer->Host(&dpnAppDesc, &m_pDP8AddrLocal.p, 1, NULL, NULL, this, 0)))
//...

HRESULT WINAPI CNetworkServerDx8::MsgProc(PVOID pvUserContext, DWORD dwMessageID, PVOID pMsgBuffer)
{
CNetworkServerDx8* This = reinterpret_cast<CNetworkServerDx8*>(pvUserContext);
_ASSERT(This);

switch(dwMessageID)
{
case DPN_MSGID_INDICATE_CONNECT:
return This->IndicateConnect(dwMessageID, reinterpret_cast<DPNMSG_INDICATE_CONNECT*>(pMsgBuffer));


That''s how I hook it up... any help?



Magmai Kai Holmlor
- Not For Rent
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
wazoo69
wazoo69
YES!!!

I wasn''t reinterpreting the cast correctly in the switch statement within my DirectPlay message handler...argh!

ie. under DPN_MSGID_CREATE_PLAYER I was just calling my
createPlayer(pMsgBuffer)...so inside the createPlayer function
it had no idea/access about the DirectPlay objects already created in my class...

Big thanks!!!

Topic Locked

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

Sign in to reply to this topic.