>I want to simulate what happens when the user does a File/Open and selects
>a
[quoted text clipped - 6 lines]
> ((EnvDTE.DTE)getService(typeof(EnvDTE.DTE))).ExecuteCommand("File.OpenFile",
> fileName);
Hi Greg,
Try using something based on this:
EnvDTE::ItemOperationsPtr ptrItemOperations =
m_pDTE->GetItemOperations();
ptrItemOperations->OpenFile( _bstr_t(sPathName),
EnvDTE::vsViewKindTextView);
This is an unmanaged C++ version using smart pointers, but the principles
should be the same in any VS.NET language.
Kind Regards,
Anna-Jayne Metcalfe
Software/Product Development Consultant,
Riverblade Limited.
http://www.riverblade.co.uk
Greg Taylor - 04 Feb 2005 17:11 GMT
Sorry:
ItemOperations.OpenFile(fileName, EnvDTE.Constants.vsViewKindTextView);
does the same thing. Also trying vsViewKindAny and vsViewKindPrimary for
the constant result in the same behaviour.
> >I want to simulate what happens when the user does a File/Open and selects
> >a
[quoted text clipped - 26 lines]
> Riverblade Limited.
> http://www.riverblade.co.uk
Greg Taylor - 04 Feb 2005 17:57 GMT
Oops, you are correct. Thanks!
> Sorry:
>
[quoted text clipped - 33 lines]
> > Riverblade Limited.
> > http://www.riverblade.co.uk
Anna-Jayne Metcalfe - 04 Feb 2005 19:04 GMT
Hi Greg,
> Oops, you are correct. Thanks!
>
[quoted text clipped - 5 lines]
>> for
>> the constant result in the same behaviour.
Glad to be able to help!
We actually use that code in our Visual Lint add-in to open std.lnt and
options.lnt (PC-Lint configuration files in text format) for editing inside
the IDE, so I was beginning to wonder whether we'd missed something....
Figuring out how to achieve your aims using the extensibility interfaces
seems to be more of an art than a science. A case in point: a little while
ago I posted a query here on how to catch double click events in the Output
Window. Although I didn't get any replies, we eventually realised we could
use some logic in the WindowActivated() event to achieve the same aim.
It's not at all obvious though, and there's so much experimentation and head
scratching in the process!
Good luck with your project.
Kind Regards,
Anna-Jayne Metcalfe
Software/Product Development Consultant,
Riverblade Limited.
http://www.riverblade.co.uk