View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JIGNESH JIGNESH is offline
external usenet poster
 
Posts: 4
Default Unexpected Behaviour of _ExcelObject_WindowDeactivate


Hi Jacob,

I don;t prefer to use Windows API. is there a Add-in way to capture
Activate and deactivate event of Excel Main/Parent MDI Window?

Regards


"Jacob Skaria" wrote:

Hi Jignesh

--Window Activate and Deactivate events are similar to MDI child window
activate/deactivate OR in other words events within one windows
application/one Process ID.

--What you are looking of is active Application. The GetForegroundWindow
function in .NET returns a handle to the foreground window

Refer http://msdn.microsoft.com/en-us/libr...05(VS.85).aspx

If this post helps click Yes
---------------
Jacob Skaria


"JIGNESH" wrote:

Hi
I am writing an Excel Addin. using VS2008 and .net 3.5
I traped following events
_ExcelObject.WindowActivate += new
Microsoft.Office.Interop.Excel.AppEvents_WindowAct ivateEventHandler(_ExcelObject_WindowActivate);
_ExcelObject.WindowDeactivate += new
Microsoft.Office.Interop.Excel.AppEvents_WindowDea ctivateEventHandler(_ExcelObject_WindowDeactivate) ;


It was surprized 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. sameway from notepad if i
switch to excel window, i expect Activate to be tiggered but its not
happening.

This is quite annoying.

Anyone knows the reason and correct way to handle it ?