passing references to ActiveX controls over COM

I've got two executables - one that has a GUI and one which is just a bunch of classes.

I want my GUI applciation to be able to trigger the second app to do some work - and i want the worker application to be able to update the GUI application's ActiveX controls directly - i don't want to raise events back to the GUI app if i can help it.

Does anyone know if i can safely pass labels and listboxes ByRef in VB?  i.e. could i declare methods in the second applciation that take a listview ByRef?  would that allow the second application to directly manipulate teh captions and items of those controls?
Who is Participating?
MS recommends that you do not do this, although you may be able to get away with passing as Object.  See the following:

PRB: Passing ActiveX Control to Component Gives "Type Mismatch" Error Message;en-us;190210

Resolution: If possible, do not pass ActiveX controls to other components in your project. If the component needs a specific control to function correctly, include that control as part of the component. Microsoft does not recommend that you pass private objects to components outside of the current project.

If you must pass ActiveX controls to your component, do not attempt to use early binding, use late binding instead. If you pass the control as a variable of type Object, any late bound calls to the base control will succeed since the extender is designed to forward unrecognized property or method calls to the internal base control.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.