COM Interop

  • Thread starter Thread starter Tibby
  • Start date Start date
T

Tibby

Boy, bet I'm being a pest now... Well, got the COM interop working, or so I
though. Here's the .NET code in the DLL...

<ComClass(Rythmia.ClassID, Rythmia.InterfaceId, Rythmia.EventsId)> _
Public Class Rythmia
#Region "COM Class IDs"
Public Const ClassID As String = "5F0D4112-B23D-4703-94F5-B5B96E50F3BB"
Public Const InterfaceId As String = "A9DFEE4E-3DBB-4505-BBC6-9BCEE5A220A5"
Public Const EventsId As String = "E6CAB551-4A34-4c4d-83EA-7D3D7E2E49DF"
#End Region
#Region "Events"
Public Event Progress(ByVal Value As Long, ByVal Maximum As Long)
Public Event Status(ByVal StatusMessage As String)
#End Region

Now, in VB6, after I referenced it, I used this:
Private WithEvents Ency As DGRE.Rythmia

Private Sub Form_Load()
Set Ency = New DGRE.Rythmia
End Sub

And I get this when I try to select an Event:
"Function or Interface is marked as restricted, or the function uses an
Automation Type not supported in Visual Basic"

Am I doing something wrong?

Tibby
 
Tibby said:
Boy, bet I'm being a pest now... Well, got the COM interop working, or so I
though. Here's the .NET code in the DLL...

<ComClass(Rythmia.ClassID, Rythmia.InterfaceId, Rythmia.EventsId)> _
Public Class Rythmia
#Region "COM Class IDs"
Public Const ClassID As String = "5F0D4112-B23D-4703-94F5-B5B96E50F3BB"
Public Const InterfaceId As String = "A9DFEE4E-3DBB-4505-BBC6-9BCEE5A220A5"
Public Const EventsId As String = "E6CAB551-4A34-4c4d-83EA-7D3D7E2E49DF"
#End Region
#Region "Events"
Public Event Progress(ByVal Value As Long, ByVal Maximum As Long)
Public Event Status(ByVal StatusMessage As String)
#End Region

Now, in VB6, after I referenced it, I used this:
Private WithEvents Ency As DGRE.Rythmia

Private Sub Form_Load()
Set Ency = New DGRE.Rythmia
End Sub

And I get this when I try to select an Event:
"Function or Interface is marked as restricted, or the function uses an
Automation Type not supported in Visual Basic"

Long in VB.NET is a 64 bit signed integer. VB6 has no corresponding type.
Long in VB6 is the same type as Integer in VB.NET.

So change your Progress event to use Integer instead of Long.

David
 
Hi Libby,

LOL.

Sometimes it's the big things. Sometimes it's the little things.

And sometimes it's the big things that used to be little things!! ;-)

Regards,
Fergus
 
Back
Top