Toon posts:

[vb.net 2005] active x dll in vb.net

Pagina: 1
Acties:

Verwijderd

Topicstarter
Ik schrijf wel eens plugins in vb6 voor een bepaald programma, een voorbeeld hiervan ziet er bijvoorbeeld als volgt uit:

Visual Basic:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Option Explicit

'Ini file
Private m_IniFile As String
Private m_IniSection As String

Private m_SourceImagePath As String
Private m_DebugLogfile As String

'Eyes & Hands Forms objects
Private objTransfer As EHF.TransferApp

Public Function Connect(ByRef ehApp As Object, ByRef strInifile As String, ByRef strIniSection As String) As Long

    'Setup global App object
    Set objTransfer = ehApp

    'Subscribe to events
    Call objTransfer.Subscribe(Me, "InvoiceTransfer", "OnInvoiceTransfer")
    
    'Remember ini settings
    m_IniFile = strInifile
    m_IniSection = strIniSection
    m_DebugLogfile = GetSetting(m_IniSection, "DebugLogfile", m_IniFile)
    
    Connect = EV_OK
End Function

Public Function Disconnect(ehApp As Object) As Long

    'Release object
    Set objTransfer = Nothing
    
    Disconnect = EV_OK
End Function

Public Function OnInvoiceTransfer() As Long

    MsgBox "KLAAAR: " & objTransfer.Info
    
    
End Function


Nu probeer ik deze plugin in vb.net 2005 te schrijven. Dit moet volgens mij wel kunnen. Ik heb een nieuw class library aangemaakt en een nieuwe com class toegevoegd aan mijn project met de volgende code:

Visual Basic .NET:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Imports System.Runtime.InteropServices

<ComClass(Transfer2.ClassId, Transfer2.InterfaceId, Transfer2.EventsId)> _
Public Class Transfer2

#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 = "0541f21e-ea70-47a5-af14-26ae14567c04"
    Public Const InterfaceId As String = "d33b492b-71ef-45fb-8d83-c84d24a9be37"
    Public Const EventsId As String = "d6bf8cbd-57ac-415e-88ef-6137d1d97ce4"
#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

    'Ini file
    Private m_IniFile As String
    Private m_IniSection As String

    Private m_SourceImagePath As String
    Private m_DebugLogfile As String

    'Eyes & Hands Forms objects
    Private objTransfer As EHF.TransferApp

    Public Function Connect(ByRef ehApp As Object, ByRef strInifile As String, ByRef strIniSection As String) As Long
        EventLog.WriteEntry("Connect", "Connected")
        'Setup global App object
        objTransfer = ehApp

        'Subscribe to events
        Call objTransfer.Subscribe(Me, "InvoiceTransfer", "OnInvoiceTransfer")

        'Remember ini settings
        m_IniFile = strInifile
        m_IniSection = strIniSection
        m_DebugLogfile = GetSetting(m_IniSection, "DebugLogfile", m_IniFile)

        Connect = EV_OK
    End Function

    Public Function Disconnect(ByVal ehApp As Object) As Long

        'Release object
        objTransfer = Nothing

        Disconnect = EV_OK
    End Function

    Public Function OnInvoiceTransfer() As Long

        MsgBox("KLAAAR: " & objTransfer.Info)


    End Function

End Class


Alleen als ik de plugin probeer te gebruiken in de applicatie dan zegt hij dat hij deze niet kan vinden.

Ben ik iets vergeten met migreren van deze vb6 plugin naar vb.net?

Verdere info:
- Bij het compileren krijg ik twee dll's. Eentje van mijn library maar ook een interop van een reference naar een com dll. Deze registreer ik beide met regasm.exe op de machine waarop de applicatie draait

  • whoami
  • Registratie: December 2000
  • Laatst online: 07:13
Moet je niets met tblexp doen ?
klik

https://fgheysels.github.io/


Verwijderd

Topicstarter
whoami schreef op zondag 23 april 2006 @ 16:01:
Moet je niets met tblexp doen ?
klik
Ik gebruiker framework 2.0 en gebruik de opties /tlb bij het registreren van de assembly met regasm.exe deze registreerd ook de tlb