Solved

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

Posted on 2003-11-18
3
343 Views
Last Modified: 2013-12-08
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
Comment
Question by:cmaduro
3 Comments
 
LVL 4

Accepted Solution

by:
joachimc earned 500 total points
ID: 9837346
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now