Connecting to an existing Automation Object
Posted on 1998-10-22
I am trying to connect to an existing Automation opbject in C/C++ (MS Visual C Version 4 or 5). I can do this easily in VB 4 or 5 using the GetObject routine and just passing the program id in the second parameter.
I can create all the prototypes for the objects methods etc by using the Class Wizard and importing the Type Library, I can create a new object using the ClassFactory. What I can't figure out is how to connect to an existing object (i.e. one that was created by another aplication that is still running). There is a routine called GetAciveObject which I can use after calling CLSIDFromProgID but I can't get the calls to the methods of the object to work, it just causes an Aplication Error (GPF) when I run them. Does anyone know how to do this, it's so simple in VB!!!