VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Is a certain form open?

by Matthew Roberts (26 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

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

Inputs
FormName
Assumes
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.
Code Returns
Boolean. True=Form is open.
API Declarations
Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long

Rate Is a certain form open?

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

Download this snippet    Add to My Saved Code

Is a certain form open? Comments

No comments have been posted about Is a certain form open?. Why not be the first to post a comment about Is a certain form open?.

Post your comment

Subject:
Message:
0/1000 characters