Jump to content
  • Advertisement


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


Invalid parameter in QueryInterface (DS)

This topic is 5740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I won't get it why this short strip of code is invalid
	if( FAILED( hr = pDsb->QueryInterface( IID_IDirectSoundBuffer8, (LPVOID*)&_pBuffer[ index ] ) ) )
		ofLog << DXGetErrorDescription9( hr ) << endl;
		safe_delete_array( lpData );
		mmioClose(hMMIO, 0);
		return ERR_INIT_FAIL;
pDsb is a LPDIRECTSOUNDBUFFER, _pBuffer is a pointer to a dynamicly located array of LPDIRECTSOUNDBUFFER8. index is an int. the DXGetErrorDescription9( hr ) says that there's an invalid parameter, but i won't get it why? Any of you pro-hackers who know? Oh, and if it matter, _pBuffer is a static member of a class. [edited by - Enselic on March 31, 2003 9:45:19 AM] [edited by - Enselic on March 31, 2003 9:45:37 AM]

Share this post

Link to post
Share on other sites
Here it is:

_pBuffer = new LPDIRECTSOUNDBUFFER8[ _nMaxNumSounds ];
for( i = 0; i < _nMaxNumSounds; i++ )
_pBuffer[ i ] = NULL;

One mentionable think is that the query doesn't fail if I have a temporary LPDIRECTSOUNDBUFFER8 variable.

[edited by - Enselic on March 31, 2003 10:28:41 AM]

Share this post

Link to post
Share on other sites
What does the debug runtime have to say about why it returned that error?

It should be telling you SOMETHING, i.e. at least whether its unhappy with the UUID, or the pointer, or whether some other part of your DS setup is at fault...

Simon O''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites
This is the error string:
"An invalid parameter was passed to the returning function"

EDIT: The lame thing is that when I pass a temporary LPDIRECTSOUNDBUFFFER8, it works...

[edited by - Enselic on March 31, 2003 12:58:02 PM]

Share this post

Link to post
Share on other sites
can you post the definition of the _pBuffer variable?

I believe you are passing the variable incorectly to the DX function, and it seems that it has something to do with the fact that it''s static.

try this:

Create a local varaible as you did before when you were testing, and use this temp variable to receive the DX interface.

Next line, assign the temp interface variable into _pBuffer[x];

IDirectSoundBuffer8 * myBuf;
pDsb->QueryInterface( IID_IDirectSoundBuffer8, (LPVOID*)&myBuf);
// Error check as usual
_pBuffer[index] = myBug;

This will clearly show you where your error is....


Share this post

Link to post
Share on other sites

I did as you said, and when the assignment to _pBuffer[index] failed, i realized there was something else wrong.

I debuged the init method, saw that the cooperative level failed, checked the error, which was "Wrong parameter", found out that the HWND param was zero, realized that I passed an old g_hWnd param to the init method resulting in hwnd to be NULL.

The whole probelm dissovled when I passed the accurate window handle...

Thank you thank you thank you!

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!