CoCreateInstance() problem.

Started by
5 comments, last by Daishim 21 years, 10 months ago
I''m using the Tricks Of The Windows Game Programming Gurus to learn DirectX and I''m trying to initialize DirectDraw4 with CoCreateInstance, but I''m getting a mind boggling error.

if(FAILED(CoCreateInstance(&CLSID_DirectDraw, NULL, CLSCTX_ALL, IID_IDirectDraw4, &lpdd4)))
		MessageBox(hWnd, "Failed to create DirectDraw object!", "DX Init Error.", MB_OK | MB_ICONEXCLAMATION);
 
Generates "cannot convert from ''const struct _GUID *'' to ''const struct _GUID" I''ve tryed casting it, but to what? ... Nothing I tried works. Am I just missing something painfully obvious? I know only that which I know, but I do not know what I know.

I know only that which I know, but I do not know what I know.
Advertisement
Don''t take the address of CLSID_DirectDraw.
---visit #directxdev on afternet <- not just for directx, despite the name
Remove the ampersand from the first parameter. Cast the 5th parameter as LPVOID*.

I keep getting the same error...even in the following.

if(FAILED(lpdd->QueryInterface(IID_IDirectDraw4, &lpdd4)))		MessageBox(hWnd, "Failed to create the DirectDraw4 object!", "DX Init Error.", MB_OK | MB_ICONEXCLAMATION); 


It still won''t let me pass the IID_IDirectDraw4 GUID.

I know only that which I know, but I do not know what I know.

I know only that which I know, but I do not know what I know.
Now all the previous code will compile... but I'm getting unresolved external on _IID_IDirectDraw4. I've got the ddraw.lib added to the link settings. Could it be that I'm using the DX8SDK?

I know only that which I know, but I do not know what I know.

[edited by - Daishi on June 8, 2002 3:16:35 PM]

I know only that which I know, but I do not know what I know.
Now you should go here.
---visit #directxdev on afternet <- not just for directx, despite the name
A search won''t help me much when the DXSDK installer installed corrupted files. A reinstall of the SDK and everything compiles and links fine.

I know only that which I know, but I do not know what I know.

I know only that which I know, but I do not know what I know.

This topic is closed to new replies.

Advertisement