MINIMIZE

Started by
4 comments, last by Mikecrosoft 21 years, 10 months ago
I have a program made with DirectX 7 (DirectDraw), this program works in FullScreen, but when I minimize the program or press ALT + TAB the program returns "Automation error with Number: -2005532222" Please helpe to solve this problem Thanks !!! Ing. Mike
Ing. Mike
Advertisement
Sounds like your surfaces are getting lost.
Your app needs to detect when its losing/gaining focus (check out windows messages in MSDN) and reload bitmaps and restore surfaces.
You''ll get info on this on the microsoft directX site.
<a href="http://www.purplenose.com>purplenose.com
quote:Original post by Carrot
Sounds like your surfaces are getting lost.
Your app needs to detect when its losing/gaining focus (check out windows messages in MSDN) and reload bitmaps and restore surfaces.
You''ll get info on this on the microsoft directX site.


OK, How I can detect if my program lost the focus, with Form_Deactivate() event ?, and I need reload all surfaces including primary and secundary surfaces, or offscreen surfaces only ?

Thanks !!



Ing. Mike
Ing. Mike
When ur program is activated or desactivated u receive a WM_ACTIVATE or WM_ACTIVEAPP message(check mdsn for that).

Then to check if ur surface has gone u use UrSurface.IsLost() function. And to restore it u use UrSurface.Restore().

But i heard like u can call a RestoreAllSurface() from ur primary surface for restoring all the surfaces without calling Restore from all ur onscreen and offscreen surfaces.

Hope this help


[edited by - remi on May 30, 2002 12:54:24 PM]
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
quote:Original post by remi
When ur program is activated or desactivated u receive a WM_ACTIVATE or WM_ACTIVEAPP message(check mdsn for that).

Then to check if ur surface has gone u use UrSurface.IsLost() function. And to restore it u use UrSurface.Restore().

But i heard like u can call a RestoreAllSurface() from ur primary surface for restoring all the surfaces without calling Restore from all ur onscreen and offscreen surfaces.

Hope this help


[edited by - remi on May 30, 2002 12:54:24 PM]



Thanks for your help, but I doing this and the program return the DDERR_WRONGMODE error, check this please:

----------------------------------------------
This code detect if the program lost the focus
into the main loop
----------------------------------------------


Sorry for not tell you, I'm using VisualBasic.            HWND_ACTIVO = GetActiveWindow                                    If HWND_ACTIVO <> DX_CAT.hWnd Then                Do                    HWND_ACTIVO = GetActiveWindow                    DoEvents                Loop While HWND_ACTIVO <> DX_CAT.hWnd                                            CHECAR_SUPERFICIES_PERDIDAS                                        End If   


------------------------------------------
This code restore all surfaces if is lost
------------------------------------------

Sub CHECAR_SUPERFICIES_PERDIDAS ()'Primary surfaceIf PRIMARIO.SUPER.isLost = DDERR_SURFACELOST Then PRIMARIO.SUPER.restore'Secundary surfaceIf SECUNDARIO.SUPER.isLost = DDERR_SURFACELOST Then SECUNDARIO.SUPER.restore'All surfacesFor I = 1 To UBound(IMAGENES)    If IMAGENES(I).SUPER.isLost = DDERR_SURFACELOST Then IMAGENES(I).SUPER.restoreNext IFor I = 1 To UBound(IMG_CAT)    If IMG_CAT(I).SUPER.isLost = DDERR_SURFACELOST Then IMG_CAT(I).SUPER.restoreNext IFor I = 1 To UBound(BOTON)    If BOTON(I).BOT_SUPER.isLost = DDERR_SURFACELOST Then BOTON(I).BOT_SUPER.restoreNext IEnd Sub   




Ing. Mike

[edited by - Mikecrosoft on May 30, 2002 2:04:22 PM]

[edited by - Mikecrosoft on May 30, 2002 2:06:13 PM]
Ing. Mike
One solution is lock ALT+TAB or other key that could minimize the program, How I can do this ?

Thanks !!!


Ing. Mike
Ing. Mike

This topic is closed to new replies.

Advertisement