Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 248
  • Last Modified:

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?
1 Solution
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

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.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now