I am making a host application that is starting up an other application as an object (like this):

Private WithEvents ProcApp As PBObjLib.Application
Set ProcApp = CreateObject("PIProcessBook.Application")

Now I have a reference to my application object: ProcApp.
Before I use the createobject function, I want to be able to detect whether an instance of the application is already running, and if so, I want this instance to be referenced by the ProcApp objectvariable.

I have made a function that can find and return a handle to the application. I do this by using FindWindow (I have the windowclass - Windowname is laft as nullstring)

So, now I know that my application is running, I even have a handle. The BIG question is how do I reference the handle to a VB object variable (ProcApp). What I need is a fantasy function calle GetObjectFromHandle(Handle as long) as object...