PC Review


Reply
Thread Tools Rate Thread

__ComObject to Interface

 
 
Mythran
Guest
Posts: n/a
 
      28th Oct 2004
I have the following (quick snip, not real):

Class MyWizard
Inherits EnvDTE.IDTWizard

Public Sub Execute(..., ContextParams As Object(), ...)

End Sub
End Class

I'm trying to convert the 2nd item in teh ContextParams object array to an
object. The problem is, all I have is an Interface type defined for it
(EnvDTE.ProjectItems interface). There is no object which implements this
that I can find in the EnvDTE library. So, how can I go about converting
the __ComObject to an object with the EnvDTE.ProjectItems interface?

TypeName(ContextParams(2)) = "ProjectItems"
GetType(ContextParams(2)).ToString() = "System.__ComObject"

The following does not work because it expects a class, not an interface:
mProjectItems =
System.Runtime.InteropServices.Marshal.CreateWrapperOfType(ContextParams(2),
GetType(EnvDTE.ProjectItems))

All help appreciated

Mythran


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook.ContactItem'. Dhananjay Microsoft Outlook VBA Programming 3 13th Oct 2007 07:56 AM
System.__ComObject is not what I want returned les Microsoft ASP .NET 2 1st Jun 2007 05:01 PM
{System.__ComObject} Ron Dahl Microsoft VB .NET 2 6th Mar 2006 01:25 PM
System.__ComObject problem Axel Strube-Zettler Microsoft C# .NET 3 16th Aug 2004 06:36 PM
__comobject Ariel Gimenez Microsoft C# .NET 0 10th Feb 2004 08:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:18 PM.