Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Problem implementing COM Interface in VB

Options
  • 10-05-2001 7:46pm
    #1
    Closed Accounts Posts: 9,314 ✭✭✭


    I want to create an object in VB which implements the
    MSXML2.IXMLDOMNode interface using the Implements keyword. It seems easy enough at first as the interface seems okay by the rules at http://msdn.microsoft.com/library/devprods/vs6/vbasic/vbcon98/vbconcreatinginterfacesforusewithimplementsstatement.htm .

    The problem is that the C/C++ definition of one of that interface's properties is:
    HRESULT get_dataType(
        VARIANT *dataTypeName);
    HRESULT put_dataType(
        BSTR dataTypeName);
    

    No problem for C, but for VB you would either implement this as this
    as:
    Private Property Let IXMLDOMNode_dataType(ByVal RHS As String)
    	'code
    End Property
    Private Property Get IXMLDOMNode_dataType() As Variant
    	'code
    End Property
    

    which is an error because the data types for Property Let and
    Property Get have to match, or else:
    Private Property Let IXMLDOMNode_dataType(ByVal RHS As Variant)
    	'code
    End Property
    Private Property Get IXMLDOMNode_dataType() As Variant
    	'code
    End Property
    

    which is an error as the
    Property Let
    
    doesn't match the type library
    for the interface being implemented.

    Can anyone think of a solution?


Comments

  • Registered Users Posts: 861 ✭✭✭Slosh


    Try Property Set, as the C code indicates a pointer to an object.


  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    Well the C is a pointer to a string, and a pointer to a BSTR in C equates to a byval String in VB.

    The problem is I can't change what way the property is defined. What I need is another way to implement an interface apart from Implements.


Advertisement