Advertisement

DX7

Started by September 03, 2001 12:02 PM
4 comments, last by cyberfool 23 years, 3 months ago
heres my directx code(init), im still getting the same problem // Global interface pointers LPDIRECTDRAW7 lpDD=NULL; LPDIRECTDRAWSURFACE7 lpDDSPrimary=NULL; LPDIRECTDRAWSURFACE7 lpDDSBack=NULL; // Create the main DirectDraw object ddrval = DirectDrawCreate(NULL, &lpDD, NULL); if (ddrval != DD_OK) { ErrStr=Err_DirectDrawCreate; return FALSE; } // Fetch DirectDraw7 interface ddrval = lpDD->QueryInterface(IID_IDirectDraw7, (LPVOID *) & lpDD); if (ddrval != DD_OK) { ErrStr=Err_Query; return FALSE; } // set cooperative level ddrval=lpDD->SetCooperativeLevel(hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); if (ddrval!=DD_OK) { ErrStr=Err_Coop; return FALSE; } // set the display mode ddrval = lpDD->SetDisplayMode( 640, 480, 16); if (ddrval!=DD_OK) { ErrStr=Err_DispMode; return FALSE; } // create primary surface with 1 back buffer DDSURFACEDESC ddsd; DDSCAPS2 ddscaps; ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize = sizeof( ddsd ); ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; ddsd.dwBackBufferCount = 1; ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ); if (ddrval!=DD_OK) { ErrStr=Err_CreateSurf; return FALSE; } // fetch back buffer interface ddscaps.dwCaps=DDSCAPS_BACKBUFFER; ddrval=lpDDSPrimary->GetAttachedSurface(&ddscaps,&lpDDSBack); if (ddrval!=DD_OK) { ErrStr=Err_CreateSurf; return FALSE; } if (!load_images()) return FALSE; return TRUE; } the problem is... ''CreateSurface'' : cannot convert parameter 2 from ''struct IDirectDrawSurface7 ** '' to ''struct IDirectDrawSurface ** '' this is REALLY annoying me now, please help soon
Are you sure your lpDD is really a LPDIRECTDRAW7, not LPDIRECTDRAW?

I''d also recommend to use
if(FAILED(... 

instead of
if (ddrval != DD_OK)  



Press any key to continue or any other key to quit...
Advertisement
ive just cut n pasted the code so its all the same as in the project.
Well, I''m just taking a wild guess here, but I think you don''t have your compiler set up right. You should make sure it searches for the directx7 libs FIRST. Else your compiler might find some directx3 or so libs that obviously can''t accept a directx7 surface.
If you are using MS Visual C++: go to "Tools->Options" Click the tab Directories. Select "show directories for include files"
Add a new directory and set it to c:\mssdk\include (if you have installed the sdk in c:\mssdk, that is).
Next select show directories for library files, add a new dir and set to: c:\mssdk\lib.
Make sure both of the new dirs are at the top of the list, by pressing the up-arrow (very important).
Make sure you include the right libs by going to project->settings. click the tab link and add: c:\mssdk\lib\ddraw.lib.
Everything should work fine now.
If you are not using MSVisual: I''ll have a hartattack for writing all the text for nothing
Anyway, hope it helps (it better...
I noticed you had to posts for this so I thought I''d respond to
both. I think I know the answer because I had the same problem.
DirectDrawCreate is not a DirectDraw7 function you need the new one. Try this or switch to non direct draw 7 types.

ddrval = DirectDrawCreateEx(NULL,(LPVOID*)&lpDD,IID_IDirectDraw7,NULL);

You are getting the error because DirectDrawCreate is looking
for an older type. The new Param is always set to IID_IDirectDraw7.
------------------------------------------------------------- neglected projects Lore and The KeepersRandom artwork
I noticed you had to posts for this so I thought I''d respond to
both. I think I know the answer because I had the same problem.
DirectDrawCreate is not a DirectDraw7 function you need the new one. Try this or switch to non direct draw 7 types.

ddrval = DirectDrawCreateEx(NULL,(LPVOID*)&lpDD,IID_IDirectDraw7,NULL);

You are getting the error because DirectDrawCreate is looking
for an older type. The new Param is always set to IID_IDirectDraw7.

Post a response to let me know that fixes it.
------------------------------------------------------------- neglected projects Lore and The KeepersRandom artwork

This topic is closed to new replies.

Advertisement