TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
normanordas
NA
25
0
Wrapping .TLB file to .DLL for .NET
Apr 19 2004 12:25 AM
I have a .tlb file(neteng.tlb) that works on a vb 6 program. This library has module-based methods that i can call anywhere and it works fine. Next I wrapped this module-based DLL(neteng.tlb) to another VB 6 COM as you have said. I did that by adding a referenced first to "neteng.tlb" library then adding the following code to the class (NETENGAPI is a module inside "neteng.tlb"): '------------------------------------ Option Explicit Public Function NE_IsNetwork1(name As String) As Boolean NE_IsNetwork1 = NETENGAPI.NE_IsNetwork(name) End Function Public Function NE_OpenNetwork1(name As String, mode As AccessModeEnum) As Long NE_OpenNetwork1 = NETENGAPI.NE_OpenNetwork(name, mode) End Function Public Sub NE_InitNetworkEngine1() Call NETENGAPI.NE_InitNetworkEngine End Sub Public Sub NE_ExitNetworkEngine1() Call NETENGAPI.NE_ExitNetworkEngine End Sub '------------------------------------ Then save the file as Netengs.DLL (class name is NetEngEng) ===>>> Process Flow: neteng.tlb wrapped inside ->netengs.dll Note: Netengs.dll purpose was to call those module-based methods inside neteng.tlb thru the class NetEngEng so we can expose them when we migrate it to .NET assembly code. I created another VB6 Prog to test netengs.dll if its gonna work (i add a referenced first to netengs.dll). See code below:. Option Explicit Dim shp As String Dim net As NetEngs.NetEngEng Private Sub Form_Load() Set net = New NetEngEng Call net.NE_InitNetworkEngine1 shp = "d:\tracking\shapes\roadcenter_mkt_only.nws" 'Dim net As New NetEngs.NetEngEng Dim bool As Boolean 'bool = net.NE_IsNetwork1(shp) bool = net.NE_IsNetwork1(shp) If bool Then MsgBox ("Is network") Else MsgBox ("Is not network") End If Dim ne As Long ne = net.NE_OpenNetwork1(shp, 1) If (ne = 0) Then MsgBox "Network " + shp + " not found.", vbCritical Exit Sub End If Call net.NE_ExitNetworkEngine1 End Sub '----------- but when i run the prog and it step into the code Call net.NE_InitNetworkEngine1 it raises this error: The instruction at "0x00001de2" referenced at "0x00001de2". The memory could not be "read." My neteng.dll that wraps neteng.tlb don't even work inside another vb 6 prog. Whats wrong with neteng.dll here? Am i missing something? It would be more disaster if i import this to interop assembly. Tnx!
Reply
Answers (
0
)
insert an image into an office application using vb.net
For mohanbabud!!