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 / May 2006

Tip: Looking for answers? Try searching our database.

.NET COM latebinding

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MikeM - 16 May 2006 18:31 GMT
I'm facing a problem where I'm trying to use a new .NET app to access
some old VB6 ActiveX exes. The ActiveX exes implement a (base) COM dll
and use an exposed method from that COM dll to do some work. Here is
what I got from the OLE viewer

pcIEBase has a public function Export
interface _clsExportBase : IDispatch {
   [id(0x6803001c), propput]
   HRESULT Export(
                   [in] BSTR sTaskInfoXML,
                   [in] BSTR sParmInfoXML);

};

so coclass pcIENewHire has an interface like this:
coclass clsExportNewHire {
   [default] interface _clsExportNewHire;
   interface _clsExportBase;
};

How do I access the public Export function via the pcIENewHire from a
.NET app? The Export function is private in the ActiveX exe that I'm
interested in. The public function in the pcIEBase.dll is just a stub,
and In essence I want to execute the Export function located within the
pcIENewHire, but my only exposure is to the public pcIEBase.dll.

On a whim I added references to both the pcIEBase and the pcIENewHire
to my .NET app and via this early binding was able to execute the
proper version of the Export function. However in the real world, I
will not know the prog id at compile time, only at run time. So this is
the rub, early binding works but I haven't figured out the latebinding
call.

Any help would be appreciated

Thanks in advance
Mike Malinowski, Software Engineer
Dmytro Lapshyn [MVP] - 18 May 2006 11:51 GMT
Hi Mike,

So what you basically need in COM terms is to do QueryInterface on
_clsExportNewHire to get _clsExportBase. This should be possible even with
late binding.  Try getting the type of the late binding reference:

Type t = typeof(myCOMObject);

and then call GetInterfaces or FindInterfaces on the obtained type to locate
the base interface.

Plus, you might find useful to read the MSDN docs on the
Marshal.QueryInterface method.

> I'm facing a problem where I'm trying to use a new .NET app to access
> some old VB6 ActiveX exes. The ActiveX exes implement a (base) COM dll
[quoted text clipped - 33 lines]
> Thanks in advance
> Mike Malinowski, Software Engineer

Rate this thread:







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.