问题如下:编程环境vc++6.0;我想用DirectSound实现一个三维立体声音同时还可进行数据库操作,但难如愿。
如果程序中不加DirectSound,单用ADO实现操作Access数据库是没有问题的,同样,如果在程序中单操作DirectSound,而不加数据库功能,声音实现也没有问题,但就两者同时加时有问题,加在后者就会出错,而前者没有问题,数据库错误如下: try
{
hr = ((CCity3DApp*)AfxGetApp())->m_pConnection.CreateInstance("ADODB.Connection");
if(!SUCCEEDED(hr))
{
return;
}
}
catch(_com_error e)
{
AfxMessageBox(e.Description());
}
CString SQL;
SQL.Format("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=%saaa.mdb;Persist Security Info=False;Jet OLEDB:DataBase Password=6666",pView->pDoc->ProgrameDirectory);
try
{
hr = ((CCity3DApp*)AfxGetApp())->m_pConnection->Open(LPCTSTR(SQL),"","",adModeUnknown); 
if(!SUCCEEDED(hr))
{
return;
}
}
catch(_com_error e)
{
AfxMessageBox(e.Description());  //这儿会出错“致命的故障”是open函数出错
}而声音的错误为:hr = DirectSoundCreate( NULL, &g_pDS, NULL);
if(hr==DSERR_ALLOCATED)
{
MessageBox(NULL, "The request failed because resources, such as a priority level, were already in use by another caller. ", "¾¯¸æ£¡", MB_OK);
m_bHasSound = false;
        return hr;
}
错误会进入if里
我的问题,上面的情况是怎样造成的?
          如何解决?