Hi,
I have an existing Add-in, (originally written for MSVC++-7.0), written in unmanaged C++ using ATL/COM. I'm attempting to convert it to a VSIX package, but existing documentation is sadly lacking in this regard. Due to the, (rather
large), existing code-base in C++, it is not feasible to convert to C#, VB or any other .NET approach. I need to remain firmly in ATL/COM land.
I have obtained the DTE, via the following, (error checking removed for clarity):
if (!_pDTE) {
CComPtr<IUnknown> punk;
pSP->QueryService(SID_SDTE, IID__DTE, (void**)&punk);
_pDTE = punk;
}
Where "_pDTE" is: CComPtr<VxDTE::_DTE> _pDTE; and
"pSP" is IServiceProvider *pSP.
This works and I can do the following for example:
_pDTE->ExecuteCommand(L"Build.Compile", L"");
Which triggers a compile of a single file as expected.
Here's the question:
How can I monitor build events? (Specifically, OnBuildBegin, OnBuildDone, OnBuildProjConfigBegin and OnBuildProjConfigDone?
Previously this was done by creating a class "BuildEventsSink" which inherits from:
IDispEventImpl<1, BuildEventsSink, &__uuidof(EnvDTE::_dispBuildEvents), &EnvDTE::LIBID_EnvDTE, 8, 0>
Then doing:
BEGIN_SINK_MAP(BuildEventsSink)
SINK_ENTRY_EX(1, __uuidof(EnvDTE::_dispBuildEvents), 3, OnBuildBegin)
SINK_ENTRY_EX(1, __uuidof(EnvDTE::_dispBuildEvents), 4, OnBuildDone)
SINK_ENTRY_EX(1, __uuidof(EnvDTE::_dispBuildEvents), 5, OnBuildProjConfigBegin)
SINK_ENTRY_EX(1, __uuidof(EnvDTE::_dispBuildEvents), 6, OnBuildProjConfigDone)
END_SINK_MAP()
Related followup question:
How can I have my VSIX package load automatically using COM/ATL once a solution is open?
Thanks in advance!
--R