Re: How do you gain access to a specific instance of Visual Studio via EnvDTE in C++ without .NET

Tech-Archive recommends: Fix windows errors by optimizing your registry



VB's GetObject maps to CoGetObject or GetActiveObject
depending on its parameters. However, I'm not sure which
takes precedence when both arguments are supplied...

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

"Stephen Vivash" <s.vivash@xxxxxxxxxxxxxxxxxx> wrote in message
news:epsvBFqYGHA.1352@xxxxxxxxxxxxxxxxxxxxxxx
The documentation gives this example for VB:

GetObject(L"C:\\Projects\\Project1\\Project1.sln",L"VisualStudio.Solution.8.0")

But I can't find a C++ example.

Without knowing much about monikers I have tried below without success:

HRESULT hResult;
CLSID clsid;
CComPtr<IUnknown> spIUnknown;
CComPtr<IMoniker> spIMoniker;
CComPtr<IBindCtx> spIBindCtx;

CLSIDFromProgID(L"VisualStudio.DTE.8.0",&clsid);
if(SUCCEEDED(hResult =
::CreateFileMoniker(L"C:\\Projects\\Project1\\Project1.sln",&spIMoniker)))
if(SUCCEEDED(hResult = ::CreateBindCtx(NULL,&spIBindCtx)))
if(SUCCEEDED(hResult =
spIMoniker->BindToObject(spIBindCtx,NULL,clsid,(void**) &spIUnknown)))
m_spIDevStudioApp = spIUnknown;

Thanks in advance

Steve






.



Relevant Pages