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 / Visual Studio.NET / Extensibility / August 2005

Tip: Looking for answers? Try searching our database.

How to use "UIHierarchy.get_SelectedItems()" in C++

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Standil - 23 Aug 2005 08:52 GMT
How can I use UIHierarchy.get_SelectedITems() in C++?

Visual Basic Code ::
 Dim UIH As UIHierarchy =
applicationObject.Windows.Item(Constants.vsWindowKindSolutionExplorer).Object
 Dim uiitem As UIHierarchyItem
   For Each uiitem In UIH.SelectedItems
     If TypeOf uiitem.Object Is Project Then
       project = uiitem.Object
     End If
   Next

C++ Code (incompleted) ::
 CComPtr<EnvDTE::Windows>    pWindows;
 CComPtr<EnvDTE::UIHierarchy>    pUIHierarchy;

 m_pDTE->get_Windows( &pWindows );

 LONG lItemCount, i;

 pWindows->get_Count( &lItemCount );
 for( i = 1; i <= lItemCount; i++ ) {
    CComPtr<EnvDTE::Window>    pWindow;
    EnvDTE::vsWindowType a_vsWindowType;

    pWindows->Item( CComVariant( i ), &pWindow );
    pWindow->get_Type( &a_vsWindowType );
    if( a_vsWindowType == EnvDTE::vsWindowTypeSolutionExplorer ) {
        pWindow->get_Object( (IDispatch **) &pUIHierarchy );
        break;
    }
 }

 pUIHierarchy->get_SelectedItems( (VARIANT *) ??????? );

If you know how to do in C/C++, please let me know.

Many thanks in advance.
Matthew Etter - 23 Aug 2005 23:07 GMT
I would recommend that you get the IVsMonitorSelection service from the
Shell. You can then simply call GetCurrentSelection.

If you're not using the VSIP interfaces, and just the EnvDTE stuff, you'll
find that get_SelectedItems returns a SelectedItems interface, which is just
a collection of SelectedItem interfaces. The VARIANT will contain the
IUnknown (or IDispatch) of the SelectedItems collection object. Depending on
how you're getting your C++ header (#import, or via tlbexp), you may see
these interfaces prefixed with underscores (eg _SelectedItem).

And I don't think you need to find the reference to the Project to do this.
You should be able to use the DTE.SelectedItems property to get the same
results.

> How can I use UIHierarchy.get_SelectedITems() in C++?
>
[quoted text clipped - 34 lines]
>
> Many thanks in advance.

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.