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



Also tried

if(SUCCEEDED(hResult =
::CreateItemMoniker(L"!",L"VisualStudio.DTE.8.0:3188",&spIMoniker)))

instead of

if(SUCCEEDED(hResult =
::CreateFileMoniker(L"C:\\Projects\\Project1\\Project1.sln",&spIMoniker)))

also, m_spIDevStudioApp is declared as follows:

CComPtr<EnvDTE80::DTE2> m_spIDevStudioApp;

Thanks again !

"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