473,385 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DTE reference in component code

I am building a component using C# (but I suppose this question would apply
to VB as well). At design time, I want this component to be able to access
the development environment. As I understand it, the canonical way to do
this is to get a reference to EnvDTE.DTE. Unlike macros and add-ins, where
such a reference is provided free of charge, the only way I have found to
get a reference is using the following code:

EnvDTE.DTE dte;
dte = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal .GetActiveObject
("VisualStudio.DTE")

which extracts the reference from the Running Objects Table. This is great
as long as you have only one instance of Visual Studio running at the time.
But what about when there is more than one instance running? Unless I've
got this all wrong, the above code extracts the reference of the first
instance in the table, which is not necessarily the instance that the my
component is in. In my scouring of newsgroups (good ol' Google!) I have
seen vague references to iterating through the entries in the Running
Objects Table to find the one you want, but I don't see any way to be able
to tell when the object in that table is *this* instance. Is there
anything that can be accessed from inside a component's code to uniquely
identify *this* instance, as opposed to those other two instances over
there? I want to be certain that the DTE reference I've found refers to
me, not some other instance over there.

Regards,
- Alex VanderWoude
Nov 15 '05 #1
0 1219

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dotnetnewbie | last post by:
Hi all I am new to .NET and webservice so I wish someone can shed some light on me. I have a Project class and a Product class, the Project can contain multiple Products (as an ArrayList). In...
2
by: Matej Kavčič | last post by:
Hello, Iam newbie, I want to ask some basic question. I come from Delphi world. In Delphi I have DataModule where i put down all coonnection, datasets and so...Is it posible and how can i do that...
2
by: Mark Broadbent | last post by:
Please guys save me from throwing my laptop throught the window grrr. No one answered my original post so here is a reworded version. I am working through some study material but have hit a brick...
3
by: Rik Beacroft | last post by:
We have the following setup. A VB6 application calls a .NET COM component that acts mainly as a forwarding system calling methods on a web service. When you open up the VB6 object browser and...
2
by: cmrchs | last post by:
Hi, in VisualStudio.NET : how can I set a reference to a component in the GAC ? ' cause the 'Add Reference' - dialog box doesn't show the components listed in the GAC thanks Chris ...
6
by: Adam Right | last post by:
Hi, I am developing a project which uses "Microsoft Word Interop". There may be a case in which the end-user may not have Microsoft Office or Office Interops. So i do not want to add a com...
3
by: cOdEmOnKeY | last post by:
I have created a component that I add to the component tray at Design time. I need to know how to access a property on this component at Runtime. From what I understand I should use Reflection to...
3
by: Mike Lewis | last post by:
I need to add a reference to a custom component in a web service. I created a new web service using VS2005 but there was no place to add a reference in the Solution Explorer. I could use Notepad...
0
by: mattmcgregor | last post by:
I'm using Visual Studio 2008 and have got a project with the following: Web Service (on a server): 1 web method that returns an xml list of files stored on the server. It references Component A...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.