Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Unexpected Behaviour of _ExcelObject_WindowDeactivate


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 ?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Unexpected Behaviour of _ExcelObject_WindowDeactivate


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 ?



  #3   Report Post  
Posted to microsoft.public.excel.programming
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 ?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Unexpected Behaviour of _ExcelObject_WindowDeactivate


Application.Hwnd returns a Long indicating the top-level window handle of the
Microsoft Excel window.

Or try Application.WindowState

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


"JIGNESH" wrote:

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 ?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Unexpected Behaviour of _ExcelObject_WindowDeactivate

Hi Jacob
Application.WindowState only has 3 state, Maximize, Minimize and Normal.
Where as what i am looking at is WindowActivate and WindowDeActivate states.

I think i will go with Application.Hwnd. Now what do i do with it?
I understand idllimport stuff. need calling of WinAPI using
but i hav't use it before. Can you help with an code example or discuss the
steps in sequence (The API i need to call to hook Activate and Deactivate
Events )

Regards

Thanks for help so far.





"Jacob Skaria" wrote:

Application.Hwnd returns a Long indicating the top-level window handle of the
Microsoft Excel window.

Or try Application.WindowState

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


"JIGNESH" wrote:

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 ?





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Unexpected Behaviour of _ExcelObject_WindowDeactivate


Check out the below link
http://www.mvps.org/access/api/api0034.htm

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


"JIGNESH" wrote:

Hi Jacob
Application.WindowState only has 3 state, Maximize, Minimize and Normal.
Where as what i am looking at is WindowActivate and WindowDeActivate states.

I think i will go with Application.Hwnd. Now what do i do with it?
I understand idllimport stuff. need calling of WinAPI using
but i hav't use it before. Can you help with an code example or discuss the
steps in sequence (The API i need to call to hook Activate and Deactivate
Events )

Regards

Thanks for help so far.





"Jacob Skaria" wrote:

Application.Hwnd returns a Long indicating the top-level window handle of the
Microsoft Excel window.

Or try Application.WindowState

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


"JIGNESH" wrote:

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 ?



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Unexpected Behaviour of _ExcelObject_WindowDeactivate


Hi Jacob

Thanks for the link.

In the Link, I believe function like sHook & sUnHook is missing,
Do you have any idea on this ?

Regards


"Jacob Skaria" wrote:

Check out the below link
http://www.mvps.org/access/api/api0034.htm

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


"JIGNESH" wrote:

Hi Jacob
Application.WindowState only has 3 state, Maximize, Minimize and Normal.
Where as what i am looking at is WindowActivate and WindowDeActivate states.

I think i will go with Application.Hwnd. Now what do i do with it?
I understand idllimport stuff. need calling of WinAPI using
but i hav't use it before. Can you help with an code example or discuss the
steps in sequence (The API i need to call to hook Activate and Deactivate
Events )

Regards

Thanks for help so far.





"Jacob Skaria" wrote:

Application.Hwnd returns a Long indicating the top-level window handle of the
Microsoft Excel window.

Or try Application.WindowState

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


"JIGNESH" wrote:

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 ?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unexpected Result Hardeep_kanwar[_2_] Excel Worksheet Functions 2 January 16th 09 03:29 PM
A unexpected behavior Marsh New Users to Excel 9 January 15th 09 06:23 PM
Unexpected (?) behaviour of OFFSET() in array formulas vezerid Excel Discussion (Misc queries) 11 December 13th 05 08:29 PM
Workbook on intranet unexpected behaviour Jean-Yves[_2_] Excel Programming 0 December 9th 03 12:19 PM


All times are GMT +1. The time now is 05:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"