Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System
- Imports EnvDTE
- Imports EnvDTE80
- Imports EnvDTE90
- Imports System.Diagnostics
- Public Module ContextMenu
- Public Sub DoSomething()
- 'Few declarations'
- Dim SolutionExplorer As UIHierarchy
- Dim Item As UIHierarchyItem
- Dim SelectedItem As EnvDTE.ProjectItem
- 'Getting the solution explorer'
- SolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
- 'Iterating through all selected items'
- For Each Item In SolutionExplorer.SelectedItems
- 'Getting the item'
- SelectedItem = CType(Item.Object, EnvDTE.ProjectItem)
- 'Do some stuff here'
- If SelectedItem.FileNames(1).EndsWith("txt") Then
- MsgBox("We got the text file!", , SelectedItem.FileNames(1))
- Else
- MsgBox("We got something else...", , SelectedItem.FileNames(1))
- End If
- Next
- End Sub
- End Module
Add Comment
Please, Sign In to add comment