IDirectDraw7::Initialize error

Started by
1 comment, last by Fredrik Hellman 23 years, 2 months ago
Hello! When I call lpDD->Initialize(NULL) in this code, an access violation error or an error in ddhelp occur. (I dunno what ddhelp is) What can be wrong? CODE ---- LPDIRECTDRAW7 lpDD; hResult = CoInitialize(NULL); if(hResult != S_OK) { return ERROR; } hResult = CoCreateInstance(CLSID_DirectDraw, NULL, CLSCTX_ALL, IID_IDirectDraw7, (LPVOID*)&lpDD); if(hResult != S_OK) { return ERROR; } hResult = lpDD->Initialize(NULL); // <- Here is the error if(fel != DD_OK) { return ERROR; } END Earlier, I used DirectDrawCreate, but I got the same error. Thank you! mrhellman@telia.com Fredrik Hellman mrhellman@telia.com
Fredrik Hellmanmrhellman@telia.com
Advertisement
ddhelp.exe is a helper application started up by ddraw when your app starts up. It takes care of restoring the original desktop mode and cleaning up other resources when your app exits (or crashes).

I encountered a similar error a while back, but a reboot solved it. Have you rebooted your machine?

Also, access violations usually indicate you are trying access data or call a function through a NULL pointer. I know you are checking for S_OK when you call CoCreateInstance, but from what I understand that is not the best thing to do. Try wrapping all of your COM calls in a FAILED macro (including DX calls) instead of checking for DD_OK or S_OK.

From the code you''ve posted (which looks good aside from the fel variable that comes out of nowhere ) it''s the only thing I can think of.

GamesToGO: The Console Gamer''s Paradise
Thank you!

Hehe, fel. Fel means error in Swedish. I was translating the code before posint it :-)

I have rebooted my machine several times, and I always get the same error :-(. Yesterday night, I was checking the harddisk with scandisk. I found some crosslinked clusters in the windows\system directory. :-) Oops.

I will test the failed macro, and hope it works.

Thanks!

Fredrik Hellman
mrhellman@telia.com
Fredrik Hellmanmrhellman@telia.com

This topic is closed to new replies.

Advertisement