Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking if a form is loaded?

Status
Not open for further replies.

SPRobson

Programmer
Jul 5, 2001
18
0
0
EU
Good Morning/Afternoon

I am automating a ActiveX EXE (that I've written in VB) from a fairly simple Visual C++ program. Everything appears to be OK. However, I want the client C++ program to be able to know when my server VB ActiveX EXE has been closed by the user. How do I do this? Is it simply a case of supplying a function in the VB ActiveX EXE interface to see if the main application form is loaded so that this function can be called by the C+ program? If so, how do I tell if a form is loaded?

Many thanks again

Simon
 
Dont know if this is the best way to do it, but it should work.

Public Property Get CheckForm() as Boolean
Dim frmCheck as Form
Dim bCheck as Boolean

bCheck = False

For Each frmCheck in Forms
If frmCheck.Name = "(form you are looking for)" Then
bCheck = True
End If
Next frmCheck

CheckForm = bCheck
End Property

Then you can just call the function from C++ and if CheckForm = True you know that the form is still in memory, and if it is = False, it has been unloaded
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top