现在我已经安装了RC,我正在接受一些我在Windows 7 Beta中搞砸的实验代码.
基本上,我试图让IAudioSessionManager2与IAudioSessionNotification共同努力,告知我创建的每个新的音频会话的小应用程序.
AudioListener(公共IAudioSessionNotification)中的Punchline代码:
//This is mostly lifted from MSDN
HRESULT STDMETHODCALLTYPE AudioListener::QueryInterface(REFIID riid, void** ppvObject)
{
if(riid == __uuidof(IUnknown))
{
*ppvObject = (IUnknown*)this;
return S_OK;
}
if(riid == __uuidof(IAudioSessionNotification))
{
*ppvObject = (IAudioSessionNotification*)this;
return S_OK;
}
*ppvObject = NULL;
return E_NOINTERFACE;
}
//m_hwnd, and WM_SESSION_CREATED are set to good values
//WM_SESSION_CREATEd via RegisterWindowMessage(...)
HRESULT STDMETHODCALLTYPE AudioListener::OnSessionCreated(IAudioSessionControl *pSession)
{
PostMessage(m_hwnd, WM_SESSION_CREATED, (WPARAM)pSession, 0);
return S_OK;
}
Run Code Online (Sandbox Code Playgroud)
代码注册我的听众:
BOOL RegisterMonitor(HWND target)
{
BOOL …Run Code Online (Sandbox Code Playgroud)