GlobalMultiUse component breaks its compatibility !!!

From: Bala (Bala_at_discussions.microsoft.com)
Date: 09/09/04

  • Next message: Gary Wardell: "Re: COM+ hanging"
    Date: Thu, 9 Sep 2004 00:15:01 -0700
    
    

    Hi,

    I have a component (ActiveX dll) with only one class in it. The instancing
    property of the class is set as GlobalMultiUse. The project compatibility is
    set as Binary Compatible.

    Problem: When a new property or procedure is added to this class and
    compiled, even though the binary compatibility is set, a new UUID is
    generated for the default interface for this class.

    As the new UUID is generated for the default interface, it doesn't give any
    warning about the compatibility breaks, but the compiled clients using this
    components fails to load. It is giving the usual "Class does not support
    expected interface..." error when the object of this component is refered...

    Due to this, everytime this component is builded all the client applications
    also needs to be compiled. Unfortunately, this component is a very base
    component and referred in almost 250 odd components...

    Question:Can any one know why this is happening and how we can avoid this???

    I am using VB 6.0 and tested this in SP4, SP5 and SP6. OS: Win NT/ Win 2K/
    Win XP

    Create a ActiveX Dll project, and add a class to it. Set the Instancing
    property of the class to GlobalMultiUse.
    Add the below listed code to that class.

    Option Explicit
    Private m_String As String

    Public Property Get MyStringProp() As String
       MyStringProp = m_String
    End Property

    Public Property Let MyStringProp(ByVal vNewValue As String)
       m_String = vNewValue
    End Property

    Compile the project. Using OLE View, get the IDL file for the compiled dll.
    Save that as GMProject_V1.idl.
    Set the binary compatibility of the project to the compiled dll. Remove the
    existing code in the class and add the below mentioned code to that class.

    Option Explicit
    Private m_String As String
    Private m_Long As Long

    Public Property Get MyStringProp() As String
       MyStringProp = m_String
    End Property

    Public Property Let MyStringProp(ByVal vNewValue As String)
       m_String = vNewValue
    End Property

    Public Property Get MyLongProp() As Long
       MyLongProp = m_Long
    End Property

    Public Property Let MyLongProp(ByVal vNewValue As Long)
       m_Long = vNewValue
    End Property

    Compile the project. Using OLE View, get the IDL file for the compiled dll.
    Save that as GMProject_V2.idl
    If you compare both the idl files, you can see that the UUID of the default
    interface would have changed. How to solve this?

    Thanks in advance... Bala...


  • Next message: Gary Wardell: "Re: COM+ hanging"

    Relevant Pages

    • Re: reference problem - compatibility
      ... reset the binary compatibility to point to that file. ... I opened the project group which contains both the standard project and the ... dll project; it wouldn't compile. ... it wouldn't compile until I removed and re-instated the dll. ...
      (microsoft.public.vb.com)
    • Re: Libraries of subs and functions
      ... The VB IDE is looking for a compiled version of the DLL itself...to ... compatibility setting or simple compile the project into a DLL ...
      (microsoft.public.vb.general.discussion)
    • Re: Reference to dll object in VBA
      ... With Compatibility set to none or Project, compile a dll in say ... probably best distribute an updated xls (with the dll reference ...
      (microsoft.public.excel.programming)
    • Re: VB6 crashes when writting OCX
      ... >The DLL is set for binary compatibility and the OCX is set for project ... >compatibility (I've got no OCX file at this point). ... Set your project to no compatibility and compile. ...
      (microsoft.public.vb.controls)
    • Re: VBA and VSTO
      ... If you compile in VB6 with Global MultiUse than all you have to do is set a reference in Excel to your dll via Tools, References and you can access your functions in the dll directly. ... You will have to register the dll as well with Windows with Regsvr32, but that can be done quite simply in VBA. ...
      (microsoft.public.excel.programming)

    Loading