Archived

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

nagromo

Ddraw can't find lock...

Recommended Posts

nagromo    676
I''ve been using Dev-Cpp to try to make a dx app, and am having problems. When I try to lock a surface, it gives me several errors, one in the DX header. Here is relevant code and headers. 68 C:\Dev-Cpp\Projects\WinApp2\Init.cpp no matching function for call to `IDirectDrawSurface7::Lock(NULL, 2013 C:\Dev-Cpp\Directx8 for DEV-C\Includes\ddraw.h candidates are: virtual and here is my code (I have the right var types)
  
    if(FAILED(DirectDrawCreateEx(NULL,(void**)&lpdd,IID_IDirectDraw7,NULL))) {
        MSGBOX("Init error.");
        KillWindow();
        return false;
    }
    
    lpdd->SetCooperativeLevel(hWnd,DDSCL_ALLOWREBOOT|DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN);
    lpdd->SetDisplayMode(800,600,32,0,0);
    
    INIT_DXSTRUCT(ddsd);
    ddsd.dwFlags = DDSD_CAPS;
    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
    
    
    if (FAILED(lpdd->CreateSurface(&ddsd,&lpddsPrimary,NULL))) {
        MSGBOX("lpdd Init error.");
        KillWindow();
        return false;
    }
    
    lpddsPrimary->Lock(NULL,ddsd,DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT,NULL);
  
and here is the header''s code:
  
    STDMETHOD(GetSurfaceDesc)(THIS_ LPDDSURFACEDESC2) PURE;
    STDMETHOD(Initialize)(THIS_ LPDIRECTDRAW, LPDDSURFACEDESC2) PURE;
    STDMETHOD(IsLost)(THIS) PURE;
*   STDMETHOD(Lock)(THIS_ LPRECT,LPDDSURFACEDESC2,DWORD,HANDLE) PURE;
    STDMETHOD(ReleaseDC)(THIS_ HDC) PURE;
    STDMETHOD(Restore)(THIS) PURE;
    STDMETHOD(SetClipper)(THIS_ LPDIRECTDRAWCLIPPER) PURE;
  
I think it thinks that Lock is virtual. Could anyone help...?

Share this post


Link to post
Share on other sites
nagromo    676
Yes, I did, and I wasn''t doing it right earlier, but had to fix that to take care of a different problem. Maybee I should just give up and decite between MSVC and full-screen GDI.

Share this post


Link to post
Share on other sites
flukus    138
"lpddsPrimary->Lock(NULL,ddsd,DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT,NULL);"

Your passing ddsd instead of &ddsd!

Share this post


Link to post
Share on other sites
flukus    138
"lpddsPrimary->Lock(NULL,ddsd,DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT,NULL);"

Your passing ddsd instead of &ddsd!

Share this post


Link to post
Share on other sites