Skip to main content
GameDev.net gamedev.net
🔒 Locked

MINIMIZE

Started by Mikecrosoft May 30, 2002 at 10:23 AM 4 replies 400+ views
Original Post
Mikecrosoft
Mikecrosoft
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
Carrot
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.
Mikecrosoft
Mikecrosoft
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
remi
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]
"...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++"
Mikecrosoft
Mikecrosoft
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 surface
If PRIMARIO.SUPER.isLost = DDERR_SURFACELOST Then PRIMARIO.SUPER.restore
'Secundary surface
If SECUNDARIO.SUPER.isLost = DDERR_SURFACELOST Then SECUNDARIO.SUPER.restore

'All surfaces

For I = 1 To UBound(IMAGENES)
If IMAGENES(I).SUPER.isLost = DDERR_SURFACELOST Then IMAGENES(I).SUPER.restore
Next I

For I = 1 To UBound(IMG_CAT)
If IMG_CAT(I).SUPER.isLost = DDERR_SURFACELOST Then IMG_CAT(I).SUPER.restore
Next I

For I = 1 To UBound(BOTON)
If BOTON(I).BOT_SUPER.isLost = DDERR_SURFACELOST Then BOTON(I).BOT_SUPER.restore
Next I

End 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
Mikecrosoft
Mikecrosoft
One solution is lock ALT+TAB or other key that could minimize the program, How I can do this ?

Thanks !!!


Ing. Mike
Ing. Mike

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.