• Advertisement

Archived

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

MINIMIZE

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
One solution is lock ALT+TAB or other key that could minimize the program, How I can do this ?

Thanks !!!


Ing. Mike

Share this post


Link to post
Share on other sites

  • Advertisement