Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 30th, 2003, 01:47 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default Instantiating COM interop classes

I had spoken with some microsoft people while I was troubleshooting a COM interop problem and they told me something interesting about using COM classes in .Net. When you use a COM class you should dimension it and instantiate it like this (let's say our COM object is "ABC" and it has one class, "xyz"):

Dim objXYZ As ABC.xyz
objXYZ = New ABX.xyxClass

Apparently when tlbimp creates the interop, it creates the class wrapper (xyzClass) AND a class interface (xyz). MS says to dim it as the interface type, but to instantiate it as the class type.

I have decompiled the interop file for a little COM that I wrote to see what the .net code looked like and I didn't get much out of it. There was the interface and the class. The interface (obviously) just had the method signatures, while the class had what seemed to be the actual methods. All the methods looked like this:

public virtual extern <methodname>...

I'm assuming that the "extern" keyword has something to do with the COM access part of it but I'm not sure.

Anyone have any idea why this is?

Peter
__________________
-Peter
compiledthoughts.com
twitter/peterlanoie





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Role Provider not instantiating jsqrd ASP.NET 2.0 Basics 0 March 26th, 2007 05:24 PM
Instantiating Interfaces simsdagr8 C# 2005 4 November 30th, 2006 07:37 AM
Instantiating Common Dialog Box Dhodie Pro VB 6 2 July 19th, 2004 04:28 AM
Instantiating a VBScript class in JavaScript russellloi Classic ASP Basics 4 July 14th, 2004 11:47 AM
Declaring and instantiating... jacob ASP.NET 1.0 and 1.1 Basics 4 August 21st, 2003 10:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.