README.md

December 4, 2022 ยท View on GitHub

Is a certain form open?

Description

Simple API call that tells whether or not a particular form is open. Useful for managing popup forms or a series of forms.

Sample usage:

If FormIsOpen("Color Picker") Then

' ....Do Something Here

Else

' ...Do Something Else Here...

End If

More Info

FormName

Goes by form title, so multiple instances of a form can be used as long as their titles are different. Also works with other applications...any window in fact, so it is not limited to your VB forms.

Boolean. True=Form is open.

Submitted On
ByMatthew Roberts
LevelBeginner
User Rating4.3 (13 globes from 3 users)
CompatibilityVB 4.0 (32-bit), VB 5.0, VB 6.0
CategoryMiscellaneous
WorldVisual Basic
Archive File

API Declarations

Private Declare Function FindWindow Lib "user32" Alias _
 "FindWindowA" (ByVal lpClassName As String, ByVal _
 lpWindowName As String) As Long

Source Code

Public Function FormIsOpen(FormCaption) As Boolean
  FormIsOpen = FindWindow(vbNullString, FormCaption)
End Function