0

I want to be able to detect when the current instance of visual studio is active or in active, but searching through the available hookable events in the _applicationObject.Events. collection has not given me any clues. I can see when a window within the application is activated/deactivated with _applicationObject.Events.WindowEvents.WindowActivated, but this is not going to help. I want to know when the who application is active, not just a document or window.

Any help appreciated.

Dib
  • 2,001
  • 2
  • 29
  • 45

2 Answers2

1

You can get the DTE.MainWindow.HWnd handle and use the Win32 API.

Carlos Quintero
  • 4,300
  • 1
  • 11
  • 18
0

You can use System.Windows.Application.Current.Deactivated and Activated events to monitor when Visual Studio becomes active.

Sergey Vlasov
  • 26,641
  • 3
  • 64
  • 66