Disappearing graphics using GDI and Directdraw

Started by
-1 comments, last by Talmon 21 years, 8 months ago
Hi Everyone...First Post! Anyway, I am having this problem using directdraw7 and gdi together and I am wondering if anyone else has encountered it. My Gdi drawn graphics objects disappear sometimes. I am writing a a little GUI utility under windows that needs to display and scroll quit a few bitmaps. At my first shot I used GDI code only and was able to get reasonable performance by using the Win32 API function ScrollWindow() to scroll, only painting the regions of the client area that were invalidated. However, I had other reasons for scrapping that version and decided that I might as well use Directdraw in a window the next time around. My drawing pipeline is double buffered. As a little test, I make the backbuffer red using an IDirectDrawSurface7::Blt colorfill then I obtain a DC for the BackBuffer and use the GDI function Rectangle() to draw a green rectangle in the top left corner. After that, I blt to the primary surface. It works fine most of the time but as I drag around or resize the window, the rectangle sometimes disappears and I end up with a totally red window. Since the call to Rectangle() isn''t failing, that really shouldn''t happen if the blt is performed first. Therefore, I assume that the blt is being done asynchronously and is sometimes postponed. (I used the DDBLT_WAIT flag by the way) So my questions is...has anyone had this happen to them and if so, how did you get around it? Thanks in advance.

This topic is closed to new replies.

Advertisement