ComClass + Events
- From: "Mähr Stefan" <stefan.maehr@xxxxxxxxxxxxxxxx>
- Date: Mon, 15 May 2006 13:18:07 +0200
Hallo NG,
ich will eine in VB.NET 2005 erstellte DLL in VB6 benutzen, das funktioniert
soweit wunderbar, nur mit Events aus dieser DLL habe ich Probleme.
Unterhalb folgt die Klassendefinition mit den beiden Events. Beide events
werden in der DLL auf jeden Fall aufgerufen.
Ich referenziere also die TLB in meinem VB6 Projekt, rufe die öffentliche
Prozedur darin auf und alles wird wunderbar ausgeführt, nur die Events des
mit WithEvents deklarierten Objekts werden nie ausgeführt ...
VB.NET ComClass
Public Class cFONWS
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "76a79db3-1639-42e9-b3f1-67f36fd9e743"
Public Const InterfaceId As String = "9e038995-6047-4883-b46b-d19ee98e29e3"
Public Const EventsId As String = "7f8fcf81-7787-4ff4-8252-7f51226787d2"
#End Region
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub
Public Event SMSC_FONUebermittlung(ByVal ReturnCode As Integer, ByVal
FileSize As Double, ByVal FileCount As Integer, ByVal message As String)
Public Event SMSC_FONWSError(ByVal strError As String)
Aufrufendes VB6 Form
Private WithEvents fon As cFONWS
Private Sub Command1_Click()
Dim bolRet As Boolean
DoEvents
Set fon = New SMSC_FONWS.cFONWS
With fon
.BenuzterID = xxx
.Teilnehmercode = xxx
.Pin = xxx
.Dokument = xxx
.Uebermittlung = xxx
.Dateiname = xxx
bolRet = .DatenUebermitteln
End With
End Sub
Private Sub fon_SMSC_FONWSError(ByVal strError As String)
MsgBox strError
End Sub
Private Sub fon_SMSC_FONUebermittlung(ByVal ReturnCode As Long, ByVal
FileSize As Double, ByVal FileCount As Long, ByVal message As String)
Dim strOut As String
strOut = ReturnCode & vbCrLf & FileSize & vbCrLf & FileCount & vbCrLf &
message
MsgBox strOut
End Sub
.
- Follow-Ups:
- Re: ComClass + Events
- From: Martin Jau
- Re: ComClass + Events
- Prev by Date: Re: Statusmeldungen im Splashscreen
- Next by Date: JPG über mehrere Seiten drucken
- Previous by thread: Drehen des Images einer Picturebox?
- Next by thread: Re: ComClass + Events
- Index(es):
Relevant Pages
|