-1

My question originates from here:

How do I know from one application that another application has an active form. Same machine (windows) running two application (a.exe and b.exe) both created in vb.net. How can a.exe know that b.exe form2 is open or not?

I know that b.exe is running via:

Public Function IsApplicationRunning(ByVal appName As String) As Process
   For Each aProcess in Process.GetProcesses()   
      If aProcess.ProcessName.StartsWith(appName, StringComparisong.CurrentCultureIgnoreCase) Then
         Return aProcess  
      End If
   Next
   Return Nothing
End Function
Community
  • 1
  • 1
smarty
  • 1

1 Answers1

0

There is no direct way and Form2 needs to expose something that can be used to identify it (e.g. a certain title).

You already have the process handle. Then, check every window of that process. If you find a window that matches, it is very likely that the specified form is open. However, there is no guarantee because it could always be a window that looks similar (but that is based on another class).

Community
  • 1
  • 1
Nico Schertler
  • 32,049
  • 4
  • 39
  • 70