我在ActiveX的Member Function 中用DirectPlay 8 
HRESULT CVoiceClient::ConnectSPServer( void)
{
   .....
   hr = g_pDPClient->Initialize( NULL, DirectPlayMessageHandler, DPNINITIALIZE_DISABLEPARAMVAL )  ;........
}
编译时出错
ompiling...
VoiceClient.cpp
C:\Windows\Desktop\game\loveChat\VoiceClient.cpp(58) : error C2664: 'Initialize' : cannot convert parameter 2 from 'long (void *,unsigned long,void *)' to 'long (__stdcall *const )(void *,unsigned long,void *)'
        None of the functions with this name in scope match the target type
Error executing cl.exe.loveChat.dll - 1 error(s), 0 warning(s)

解决方案 »

  1.   

    本人不懂directplay,但是从出错信息来看。你的回调函数定义应该加上__stdcall调用规则修饰关键字。比如像下面的形势
    long WINAPI DirectPlayMessageHandler(void*, UINT, void*);
      

  2.   

    补充
    #define WINAPI __stdcall
      

  3.   

    DirectPlayMessageHandler是成员函数吗? 做成静态的或者全局的呀!
      

  4.   

    谢谢各位大虾们。我听取Cline(营营)的建议 ,把DirectPlayMessageHandler写成全局的。之后在Internet Explorer 中加载时出错(致命错误)。请问各位,在ActiveX的中用DirectPlay 8 该怎么做比较合适呢?