bool Init_Graphics(HWND hwnd)
{
LPDIRECTDRAW lpdd = NULL;
LPDIRECTDRAW lpdd4 = NULL;
DirectDrawCreate(NULL, &lpdd, NULL);
lpdd->QueryInterface(IID_IDirectDraw4, (LPVOID *) &lpdd4);
lpdd->Release();
lpdd4->SetCooperativeLevel(hwnd, DDSCL_NORMAL);
lpdd4->Release();
return true;
}
I''m using the DX7 sdk, if it makes a difference.
DirectDraw won't init
I am trying to get DirectDraw to work but the following code keeps causing an illeagle operation error immediately at the program start.
Hello!
I am not a C-Programmer, but I'm trying to help you.
here's my code:
bool Init_Graphics(HWND hwnd)
{
LPDIRECTDRAW lpdd = NULL;
LPDIRECTDRAW lpdd4 = NULL;
DirectDrawCreate(NULL, &lpdd, NULL);
lpdd->QueryInterface(IID_IDirectDraw4, (LPVOID *) &lpdd4);
lpdd4->SetCooperativeLevel(hwnd, DDSCL_NORMAL);
return true;
}
bool Game_Shutdown()
{
if (lpdd4)
{
lpdd4->Release();
lpdd4 = NULL;
return true;
}
}
cu
chlupp2000
Starbyte Developments
Edited by - chlupp2000 on August 3, 2001 1:55:08 AM
I am not a C-Programmer, but I'm trying to help you.
here's my code:
bool Init_Graphics(HWND hwnd)
{
LPDIRECTDRAW lpdd = NULL;
LPDIRECTDRAW lpdd4 = NULL;
DirectDrawCreate(NULL, &lpdd, NULL);
lpdd->QueryInterface(IID_IDirectDraw4, (LPVOID *) &lpdd4);
lpdd4->SetCooperativeLevel(hwnd, DDSCL_NORMAL);
return true;
}
bool Game_Shutdown()
{
if (lpdd4)
{
lpdd4->Release();
lpdd4 = NULL;
return true;
}
}
cu
chlupp2000
Starbyte Developments
Edited by - chlupp2000 on August 3, 2001 1:55:08 AM
quote:Original post by Daishibool Init_Graphics(HWND hwnd){ ... lpdd4->Release(); return true;}
I''m just guessing here, but do you use lpdd4 for anything after calling Init_Graphics? If you do, then I see the problem. You are releasing DirectDraw right after initializing it. Remove the line "lpdd4->Release()" and it should work.
LPDIRECTDRAW7 lpdd = NULL;
// Obtain a pointer to an IDirectDraw7 interface
DirectDrawCreateEx(NULL, (VOID**)&lpdd, IID_IDirectDraw7, NULL);
// Set the cooperative level
lpdd->SetCooperativeLevel(hWnd, DDSCL_NORMAL);
// Obtain a pointer to an IDirectDraw7 interface
DirectDrawCreateEx(NULL, (VOID**)&lpdd, IID_IDirectDraw7, NULL);
// Set the cooperative level
lpdd->SetCooperativeLevel(hWnd, DDSCL_NORMAL);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement