Minimizing and direct-draw

Started by
1 comment, last by olle55 21 years, 4 months ago
Hello. I am wrinting a game using directdraw, and im trying to to make it minimizable. If i just minimize it now, BltFast(); will return an error, I guess that is since there is no surface to blit to( right? ). Anyway, i cant realy figure out how to fix this. I tried to make a global and set it to true whenever the window was minimized, and check the global befor all the blitting. Coulden''t get it to work however, dont know why. This is what i used to check if the window was minimized. I have tried it *works* in the manner that it changes the g_bMinimized to true when it is minimized. But BltFast still returns an error. I was thinking maybe the msg queue isnt fast enough and BltFast maybe have blitted already? I dont know. I heard something about the queue beeing slow and it could take a few frames before a message ended up in the message proc.. Anyway thanks in advance for any help on this, maybe im attacking the problem all wrong, if you have any code that pauses a program while its minimized it would be very nice to see it. Thanks My code to check if the window is minimized:
  
case WM_SYSCOMMAND:
			if( wParam == SC_MINIMIZE )
				g_bMinimized = FALSE;

			if( wParam == SC_RESTORE )
				g_bMinimized = TRUE;
		break;

  
Advertisement
The WM_SYCOMMAND is sent when the user gives the command, so it the window state hasnt changed when you receive it. I think what you look for is WM_SIZE. It is sent to the window after it has been resized.
[My Lousy Page | Kings Of Chaos | Vampires | [email=lordlethis@hotmail.com]email.me[/email]]
Here''s my code to do this:
BOOL IsActive = true;...snip...LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){    switch (message)    {        case WM_ACTIVATEAPP:            IsActive = (BOOL)wParam;            break;...snip...    }} 

Then, in my rendering loop, I just check the value of IsActive, and if it''s false, I don''t render.

- Andy Oxfeld

This topic is closed to new replies.

Advertisement