Page 1 of 1

close all Windows of App

Posted: Mon May 16, 2022 1:47 pm
by AUGE_OHR
hi,

i have a lot of Child Windows and a Main Window.

Code: Select all

PROCEDURE MAIN
   DEFINE WINDOW IPTVMAIN
	...
   END WINDOW

   AddControl(nWidth,nHeight)
	
   CENTER WINDOW IPTVMAIN
   Activate Window ALL         // for ALL
RETURN
and Child Window are create in a loop

Code: Select all

PROCEDURE AddControl(nWidth,nHeight)
   FOR i := 1 TO iMax
      oWin := "VLCAXWIN_" + STRZERO( i, 3 )
      DEFINE WINDOW &oWin
	...
      END WINDOW
      AADD( aWin, oWin )
   NEXT
   _ActivateWindow ( aWin, .F. )   // Child-Windows
RETURN
that work fine.

now when i close (ALT-F4) a Child-Window i want to close all Child-Window but not Main ("IPTVMAIN"), how :idea:
i guess i need

Code: Select all

   ON RELEASE ??? ;
   ON INTERACTIVECLOSE ??? ;
but how, in a loop, while it will work recursive ...

Re: close all Windows of App

Posted: Mon May 16, 2022 4:38 pm
by serge_girard
Jimmy,

Try something like this:

Code: Select all

FOR j = 1 TO iMax

   X4    := ...

   IF IsWIndowActive (X4 )  // or IsWIndowDefined
      DoMethod ( X4 , 'Release' )   
   ENDIF

NEXT 


Re: close all Windows of App

Posted: Wed May 18, 2022 1:38 am
by AUGE_OHR
hi Serge,

it seem it was a Problem of ActiveX when "Connection" can not "hangup" and a Window is "waiting"

i´m using _ActivateWindow() and

Code: Select all

   IF IsWindowDefined( &oWin )   // multi Windows ... using Macro ?
      IF !EMPTY( oVLC )
         oVlc:Stop()
         DO EVENTS
         hb_idleSleep( .1 )

         oVLC:Destroy()
         DO EVENTS
         hb_idleSleep( .1 )
      ENDIF

      Domethod( oWin, "RELEASE" ) // crash here
      DO EVENTS
and got this Error
Window: VLCAXWIN_012 is not active. Program terminated
Called from _RELEASEWINDOW(4157)
Called from DOMETHOD(10600)
Called from CLOSEALLANDSHOWMAIN(1012)
Called from (b)MAIN(279)
Called from _DOCONTROLEVENTPROCEDURE(6713)
Called from EVENTS(1862)
Called from DOMESSAGELOOP(0)
Called from _ACTIVATEWINDOW(6256)
Called from _ACTIVATEALLWINDOWS(6324)
Called from MAIN(297)
i wonder whle i "check" for

Code: Select all

      IsWindowDefined( &oWin )
before

Code: Select all

      Domethod( oWin, "RELEASE" ) // crash here

Re: close all Windows of App

Posted: Wed May 18, 2022 11:15 am
by serge_girard
I have same problem with

Code: Select all

Domethod( oWin, "RELEASE" ) // crash here
(sometimes...)

Very frustrating...

Re: close all Windows of App

Posted: Wed May 18, 2022 2:03 pm
by mlnr