title: C#: Excel 2007 Addin, How to Hook Windows Activate and Deactivate Events
body: <p>I am writing an Excel 2007 Addin. using VS2008 and .net 3.5, C#.</p>
  
  <p>I catched Microsoft.Office.Interop.Excel.Application's WindowActivate and WindowDeActivate events.</p>
  
  <p>It was surprised to know that WindowActivate and Deactivate only triggers when i switch between two Excel Windows.  if i switch to notepad, i expect Deactivate to be triggered, but its not happening. same way from notepad if i switch to excel window, i expect Activate to be triggered but its not happening. It looks like the behaviour indicates windows are MDI-Child windows.</p>
  
  <p>Now what i want to do is get HWnd of Excel's Mainwindow and hook Window Activate and Deactivates using dllimport features.</p>
  
  <p>Can anyone guide to me on this.</p>
  
  <p>Regards</p>