Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Problem implementing COM Interface in VB

  • 10-05-2001 07: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, Registered Users 2 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