passing references to ActiveX controls over COM

Posted on 2005-05-06
Last Modified: 2013-11-18
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?
Question by:kenshaw
    1 Comment
    LVL 38

    Accepted 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;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.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now