Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / June 2006

Tip: Looking for answers? Try searching our database.

Getting a COM object from a DLL call

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Austin - 17 Jun 2006 19:52 GMT
Hi,

I am trying to use a fairly old library with VB.Net

It is COM based, so I have just added a reference to it and that bit is OK.

The problem is that the main object that needs to be created, must be done
from a DLL call.  In VB6, this was just:

Private Declare Function GetEngineObject Lib "FREngine.dll" (engineObj As
FREngine.Engine) As Long

Sub Init
   Dim Engine As FREngine.Engine
   Dim Success As Integer '0=success

   Success=GetEngineObject(Engine)
End Sub

------------------------

For VB.Net, this fails, returning an invalid pointer error code.

I presume that the declare should become:

Private Declare Function GetEngineObject Lib "FREngine.dll" (ByRef engineObj
As IntPtr) As Int32

The call to this function then succeeds, however, how do I marshall the
IntPtr to the Engine object in order to be able to use it.  And is that all
I need to do?

Any help on this would be greatly appreciated,

Chris
Chris Austin - 18 Jun 2006 08:37 GMT
Ignore this message.  Not thinking straight!

Just hadn't added a Byref the first time.

> Hi,
>
[quoted text clipped - 32 lines]
>
> Chris

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.