Archived

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

Dez

DirectDraw Surface Problem

Recommended Posts

Hey everybody, I''m trying to get the example from the DirectX 7 SDK working and I cannot figure out why I''m getting this error: Compiling... Learning Code.cpp C:\Msdev\Projects\Testing Ground\Learning Code.cpp(51) : error C2664: ''CreateSurface'' : cannot convert parameter 1 from ''struct _DDSURFACEDESC2 *'' to ''struct _DDSURFACEDESC *'' (new behavior; please see help) Error executing cl.exe. Learning Code.obj - 1 error(s), 0 warning(s) // Here is part of my code: DDSURFACEDESC2 ddsd; LPDIRECTDRAWSURFACE7 FAR *g_pddsPrimary; // Initializes ''ddsd'' structure InitStruct(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_TEXTURE; ********************** Error Line ******************************* // Create the primary surface. hr = g_pDD->CreateSurface( &ddsd, &g_pddsPrimary, NULL ); ***************************************************************** if( FAILED( hr ) ) return hr; I can''t understand why I''m getting this error, but I''ve seen the exact same code a dozen times tonight (looking for the answer). If anyone could help me, I would appreciate it. Thank you in advance.

Share this post


Link to post
Share on other sites
CreateSurface takes a DDSURFACEDESC if g_pDD is an LPDIRECTDRAW or LPDIRECTDRAW4 object. It only takes a DDSURFACEDESC2 if it is a LPDIRECTDRAW7 object. You should make sure that g_pDD is a LPDIRECTDRAW7.

Share this post


Link to post
Share on other sites