Abbat, I don't know if you got my reply to the list. I'd go like this instead (this is code to add to the form(s) you want to check):
* Private $bActive As Boolean = False** 'This private form variable will hold the form's state ** Public Property Read IsActive As Boolean 'This property will return the private variable value** ** Private Function IsActive_Read() As Boolean 'The function declaration for reading the property** ** Return ***$bActive * ' the current form state is returned** ** End** ** Public Sub Form_Activate() 'This sub will change the **private variable value to Active. ** **$bActive**** = True** ' flag the state as Active. ** End** ** Public Sub Form_Deactivate()** 'This sub will change the **private variable value to Inactive. ** **$bActive**= False** ' flag the state as Inactive.** ** End* This works as follows: When you initially instance the form, the private variable *$bActive* is set to FALSE. When the form is activated, the *Form_Activate* event triggers and sets the private variable *$bActive* as TRUE; when the form is deactivated, the *Form_Deactivate* event triggers and sets the *$bActive* variable to FALSE. At any time, code external to the form can check the new form property *IsActive* to find out if the form is active or not. This new property will return the value TRUE or FALSE that has been set to the *$bActive*** variable. External code can check the new *IsActive* form property as follows: * Dim myForm As New frmWithProperty 'frmWithProperty is a form with the above new property code included [... code ...] ** If myForm.IsActive Then [... code for when the form is active...] Else ** [... code for when the form is not active...] Endif [... even more code ...]* The property can be added the same way to a single, some, or all forms in the project. Regards, zxMarce. *On 04/May/2015 09:24, abbat81 wrote:* > Dim dw As DesktopWindow > For Each dw In Desktop.Windows > Print "_" & dw.VisibleName > Next > > I got next: > > _ > _ > _ > _ > _ > _ > _ > _ > _ > _ > _ > _ > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user