Re: How do you gain access to a specific instance of Visual Studio via EnvDTE in C++ without .NET
- From: "Stephen Vivash" <s.vivash@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 20 Apr 2006 17:52:58 +1000
This seems to work !
bool CVc8ExternalDebugger::Attach(LPCTSTR lpszSolution)
{
ULONG nEaten;
HRESULT hResult;
CComPtr<IMoniker> spIMoniker;
CComPtr<IBindCtx> spIBindCtx;
CComPtr<EnvDTE::_Solution> spISolution;
CComPtr<EnvDTE::_DTE> spIDTE;
return SUCCEEDED(hResult = ::CreateBindCtx(NULL,&spIBindCtx)) &&
SUCCEEDED(hResult =
::MkParseDisplayName(spIBindCtx,CComBSTR(lpszSolution),&nEaten,&spIMoniker))
&&
SUCCEEDED(hResult =
spIMoniker->BindToObject(spIBindCtx,NULL,__uuidof(EnvDTE::_Solution),(void**)
&spISolution)) &&
SUCCEEDED(hResult = spISolution->get_DTE(&spIDTE)) &&
SUCCEEDED(hResult =
spIDTE->QueryInterface(__uuidof(EnvDTE80::DTE2),(void**)
&m_spIDevStudioApp));
}
"Alexander Nickolov" <agnickolov@xxxxxxxx> wrote in message
news:Og5HO9xYGHA.1348@xxxxxxxxxxxxxxxxxxxxxxx
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
.
- References:
- Prev by Date: Re: How do I debug an Access Violation when I exit DialogProc?
- Next by Date: Re: In-process cross-thread (cross-apartment) marshaling
- Previous by thread: Re: How do you gain access to a specific instance of Visual Studio via EnvDTE in C++ without .NET
- Next by thread: WUA IUpdate2.CopyToCache returns always "File not found"
- Index(es):
Relevant Pages
|