[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 368
  • Last Modified:

if(FAILED(IDirectDrawSurface4->Blt(,,,,))), FAILS, but returns DD_OK

int SGE_RenderFrame()
{
      DDBLTFX      ddbltfx;
      RECT      dest_rect;
      
      //Init structures
      _DDRAW_INIT_STRUCT(ddbltfx);

      ddbltfx.dwFillColor = rand()%255;
      
      int x1 = rand()%SCREEN_WIDTH;
      int x2 = rand()%SCREEN_WIDTH;
      int y1 = rand()%SCREEN_HEIGHT;
      int y2 = rand()%SCREEN_HEIGHT;

      dest_rect.left = x1;
      dest_rect.right = x2;
      dest_rect.top = y1;
      dest_rect.bottom = y2;

      if(FAILED(lpddsprimary->Blt(&dest_rect, NULL, NULL, DDBLT_WAIT |
                                                                                             DDBLT_COLORFILL,
                                                                                             &ddbltfx)))
            return(1);
      

      return(0);
}



This function fails, and i checked the return value, it seems to be equal to DD_OK.
0
cmaduro
Asked:
cmaduro
1 Solution
 
joachimcCommented:
Are you checking with the macros provided by MS ?

You should always check the return values with
if (SUCCEDED) or if(FAILED)

Otherwise you might not get the expected result.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now