Archived

This topic is now archived and is closed to further replies.

imDivineLight

Wierd OLE32 Access voilation, please help!

Recommended Posts

Hi! I have been coding sound core for many hours, and at the end i am getting access voilations, please see the following code:
bool cSoundCore::Init( HWND hWnd )
{
	CoInitialize(NULL);
  
        // This mad func causes error.

	CoCreateInstance(CLSID_DirectMusicLoader, NULL, 
		CLSCTX_INPROC, IID_IDirectMusicLoader8,
		(void**)&mpDMLoader);

	CoCreateInstance(CLSID_DirectMusicPerformance, NULL,
		CLSCTX_INPROC, IID_IDirectMusicPerformance8,
		(void**)&mpDMPerformance );

	// Initialize DirectMusic and DirectSound

	mpDMPerformance->InitAudio(	NULL, NULL, hWnd, 
		DMUS_APATH_DYNAMIC_STEREO, 64, DMUS_AUDIOF_ALL, NULL);

	// Set search directory as current directory

	char szSearchPath[MAX_PATH];

	GetCurrentDirectory(MAX_PATH,szSearchPath);
	SetSearchDirectory(szSearchPath);

	return true;
}
now i have tried every thing, i have checked MS docs they all do like this, i even copied & pasted their code, but still the same error, i think OLE32 is COM thing, & i may have been doing something wrong with COM please tell me whats wrong here!

Share this post


Link to post
Share on other sites