//经测试,创建缓冲区ppDSBuffer正确
dsond->CreateSoundBuffer(dsbf,&ppDSBuffer,NULL);
//利用ppDSBuffer对象的QueryInterface总是出错,调试可以看到提示"__vfptr = CXX0030: 错误: 无法计算表达式的值"IDirectSoundNotify *lpDsNotify;
ppDSBuffer->QueryInterface(IID_IDirectSoundNotify,(VOID**)&(lpDsNotify));请问是什么原因啊,我在网上找了一些代码来看,参数好像都是一样的,但就是不对,想问下是不是缺少什么头文件或库文件呢?谢谢各位大侠!

解决方案 »

  1.   

    1.能编译通过说明不是缺少什么类库或头文件
    2.查看CreateSoundBuffer的返回值,是否创建Sound Buffer成功
    3.这类问题不属于网络编程范围,发到其他板块会比较好些。
      

  2.   

    dsond->CreateSoundBuffer(dsbf,&ppDSBuffer,NULL);的返回值是DS_OK吗?
    ppDSBuffer的值确定不是NULL?
      

  3.   

    dsond->CreateSoundBuffer(dsbf,&ppDSBuffer,NULL);的返回值是DS_OK,调试显示的buffer值是0x00de89d0,但QueryInterface的返回值是E_NOINTERFACE
      

  4.   

    你的dsbf参数有没有设置DSBCAPS_CTRLPOSITIONNOTIFY属性?必须设置DSBCAPS_CTRLPOSITIONNOTIFY属性的buffer object才支持IDirectSoundNotify8接口。The interface is obtained by calling the QueryInterface method of an existing interface on a DirectSound buffer object. Secondary buffers support notifications only if they are created with the DSBCAPS_CTRLPOSITIONNOTIFY flag.