![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#11
| |||
| |||
|
#12
| |||
| |||
|
#13
| |||
| |||
|
|
Hi Boris, After doing more research on EnvDTE, I manage to get the current running VS IDE instance in a custom designer and get notified when the build starts. Please ignore my previous reply about EnvDTE. The following are the steps of my test. 1. Create a Visual C++ CLR Windows Forms Control Library project. 2. Add references to EnvDTE, EnvDTE80 and System.Design assemblies in this project. 3. Add the following code in the custom UserControl.h file: using namespace EnvDTE; using namespace EnvDTE80; namespace CControl { public ref class MyDesigner: System::Windows::Forms: esign::ControlDesigner{ public: virtual void Initialize(System::ComponentModel::IComponent^ component) override { ControlDesigner::Initialize(component); DTE2^ dte2; dte2 = (DTE2^)System::Runtime::InteropServices::Marshal:: GetActiveObject("VisualStu dio.DTE.8.0"); dte2->Events->BuildEvents->OnBuildBegin += gcnew _dispBuildEvents_OnBuildBeginEventHandler(this,&My Designer::BuildEvents_OnBu ildBegin); } void BuildEvents_OnBuildBegin(vsBuildScope Scope, vsBuildAction Action) { System::Windows::Forms::MessageBox::Show("Build Starts..."); } }; [Designer(CControl::MyDesigner::typeid)] public ref class CControlControl : System::Windows::Forms::UserControl { .... }; } 4. Build the project. 5. Add a new Visual C++ CLR Windows Forms Application project in the same solution and drag the custom UserControl from the Toolbox onto the form in the WinForm application project. 6. Build the solution. A messge box saying "Build Starts..." pops up. Please try it on your side to see if it works and let me know the result. Sincerely, Linda Liu Microsoft Online Community Support |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |