COM Interop

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
 
D

David Browne

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
 
T

Tibby

Someone got a big hand I can smack myself with. Jeez LMAO

Thanks again David
Tibby
 
F

Fergus Cooney

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top