Click to See Complete Forum and Search --> : Activex


ranjit
September 12th, 1999, 03:15 AM
Can we pass a form to an Activex Exe .I have an Activex Dll to which I pass a form and change the caption and the form's caption gets changed but the same is not happening with an Activex Exe , the dll and the exe and the form are on the same machine. Is this proper or is something going wrong.

Vinayak Sapre
September 12th, 1999, 02:12 PM
My recommendation
You might be able to do that if both client & server are VB apps. But you should never do that in either cases (DLL / Server).
Package all required properties of the form and pass to the server. Server will return the changed properties. Then client (Owner of the form) takes care of updating the form properties. So server receives parameters of the standard data types. And everthing will be leagal and fine.

Brief description of problem
All GUI CLASSES are always Private in VB. And you cannot pass references of private object to the outside world. There are two reasons.
1) If your class is private it's not part of the type library. So client is unaware of the methods. So client can't use it.
2) If the server deletes the object, VB will not take care of checking if client is still using it or not. So client has invalid reference.

In your case VBRuntime is one (inproc) server and your ActiveX exe is another (outproc). MSVBVM creates form object gives reference to standard exe. It is private inside standard exe. So it should not be passed outside.

On the otherside if your ActiveX Exe is in C++ it is not really aware of the "Form" class exposed by MSVBVM. So can't use it.