close all Windows of App

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

close all Windows of App

Post 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 ...
have fun
Jimmy
User avatar
serge_girard
Posts: 3420
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: close all Windows of App

Post 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 

There's nothing you can do that can't be done...
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: close all Windows of App

Post 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
have fun
Jimmy
User avatar
serge_girard
Posts: 3420
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: close all Windows of App

Post by serge_girard »

I have same problem with

Code: Select all

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

Very frustrating...
There's nothing you can do that can't be done...
mlnr
Posts: 129
Joined: Fri Aug 28, 2015 1:52 pm
DBs Used: DBF

Re: close all Windows of App

Post by mlnr »

Post Reply