Public Group

#### Archived

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

# Displaying pictures in directdraw(windowed mode)

This topic is 5224 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have been trying to display a picture for the ddraw app, and I am using a bmp reader that I got out of a book(big mistake?) it has been hard to initialize the palette and even draw when I converted to windowed mode so now I am trying to just use the windows commands to replace the custom ones in book. I am using the WM_PAINT function, let me list code:
case WM_PAINT:
hdcClient = BeginPaint(hwnd,&ps);
hdcWindow = GetWindowDC(hwnd);
RECT rect;
GetClientRect(hwnd,&rect);
rect.left=0; rect.right=SCREEN_WIDTH;
rect.top=0; rect.bottom=SCREEN_HEIGHT;
lpPrimary->Blt(&rect,lpBackground,&rect,DDBLT_WAIT,NULL);
ReleaseDC(hwnd,hdcWindow);
EndPaint(hwnd,&ps);
return 0;

I run into a problem when I run this--Is it because I am doing my surfaces wrong? I have an lpPrimary, and an lpSecondary--lpBackground would be my background surface which I would assume just gets blitted to the secondary then from secondary to primary to be drawn...with page flipping, it''s fine, but with windowed it gets confusing

##### Share on other sites

RECT rect;
GetClientRect(hwnd,&rect);
rect.left=0; rect.right=SCREEN_WIDTH;
rect.top=0; rect.bottom=SCREEN_HEIGHT;

first fill your rectangle structure with the window area, then you overwrite the structure with the screen area.

Deleting the last two lines in the section quoted should make a difference.

Hope it helps.

Stevie

[edited by - Stevie56 on February 7, 2004 7:39:59 AM]

• 10
• 17
• 9
• 14
• 41