Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


DirectPlay Message handler as class member?

This topic is 5549 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I tried to develop my first game and put multiplayer functionality in it. I did everything object-oriented put the DirectPlay Message Handler in an object, so I did not make it static. When compiling, I get a mistake like this: error C2664: ''IDirectPlay8Peer::Initialize'' : Converting of Parameter 2 of ''HRESULT (PVOID,DWORD,PVOID)'' in ''const PFNDPNMESSAGEHANDLER'' not possible So the initialize - function does not seem to want a nonstatic function as a parameter. I tried using an approach I found somewhere and made a wrapper like this: HRESULT DPMsgHandlerWrapper (PVOID pvUserContext, DWORD dwMessageId, PVOID pMsgBuffer) { return m_pGameClass->DirectPlayMessageHandler (pvUserContext, dwMessageId, pMsgBuffer); } ..and I put that wrapper-handler in my initialize function, but the mistake does not change. How do you all program your DirectPlay Applications? Is there a solution for this problem or is the DirectPlay MessageHandler just supposed to be static? Thanks a lot for your help.

Share this post

Link to post
Share on other sites
I haven''t tried putting it inside an object, BUT that wrapper approch can''t be wrong.

Since it''s a normal msg-handler function it has to work.

Check that you set DPMsgHandlerWrapper to your DPmsgProc and NOT m_pGameClass->DirectPlayMessageHandler!

You should be able to type any kind of c++ code inside your wrapper class

Petter Nordlander

"There are only 10 kinds of people in the world. They who understand binary and those who do not"

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!