Skip to main content
gamedev.net
🔒 Locked

DirectPlay

Started by alaa_m 0 replies 300+ views
Original Post
alaa_m
alaa_m
Hello to every one, I have this problem in my project and I hope some one will help me or give me any hints. Please this is very important to me. I made a COM object encapsulating special purpose DirectPlayPeer-base class for my project. I pass DirectPlayPeer messages to my client application using an interface pointer like this: in my COM object MIDL_INTERFACE.... IDPlayPeerCallBack = interface(IUnknown) { // DirectPlay8Peer msgs }; Client applications implement ''IDPlayPeerCallBack'' interface and passes a pointer to it to my COM object like this: In client apps: class CDPlayPeerCallBack : public IDPlayPeerCallBack { ... }; ... MyComObj->SetDPlayPeerMsgHandler(new CDPlayPeerCallBack()); Now in my DirectPlay8Peer msg handler (in my COM dll), here''s how i pass the msgs to client apps: HRESULT WINAPI DPlayPeerMsgHandler(...) { switch (dwMsgId) { ... case DPNMSGID_ENUM_HOSTS_QUERY: ... if (pThis->m_pDPlayPeerCallBack) pThis->m_pDPlayPeerCallBack->OnEnumHostsResponse(...); ... } ... } Every thing works fine, The client application gets all DirectPlay msgs with no problems. However in the OnEnumHostsQuery(...) handler, I show a message box asking if the user wants to accept the incoming connection. The message pops and the user selects his/her response, but the other application doesnt always receive an DPNMSGID_ENUM_HOSTS_RESPONSE msg!! Actually it doesn''t receive the msg most of the tries. I traced that and i found that the DirectPlay thread sometimes sleeps waiting for something, I removed the portion of code that shows the message, and every thing works fine!! This problem only exists when i show a message using MessageBox() win32 api function!!! I am very confused. Any ideas ?! Thanks Alaa,
Alaa,
alaa_m
alaa_m
IDirectPlayCallBack = interface(IUnknown)
was ment to be
IDrectPlayCallBack : public IUnknwon

Just thought i was writing some delphi code!! hehe

Alaa,
Alaa,

Topic Locked

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

Sign in to reply to this topic.