Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Excel losing focus, but remains active !

Hello,
I have written an excel add-in. The add-in has a C++ shim, and the UI
is in .NET.
In the add-in (C++ part) I use the ShowDialog method to display a
browser.
I pass the excel handle, as an argument to the ShowDialog method.


When i close the browser, Excel should regain focus and then for a
brief moment, it appears to do so..(i.e. the window title bar becomes
dark blue) but then focus dissapears (to i don't know where).

However excel is still the active application!
If i start typing immediately I can type fine inside excel, I can
access all of the menus, use the row keys to go up and down the
worksheet!
But the title bar is still a lighter shade of blue (as if it is not
the active application).

How is this even possible ? If i am typing in excel shouldnt this
window be the active window?

The window becomes "active" if i resize a column, or if i switch to an
other window and come back. or minimize and restore. Deleting data
does not seem to do it.

I have tried various things, such as setforegroundwindow, setFocus
etc.
The problem is, that the part where the window loses focus, is in the
Excel code, and occurs after my code has run. Its not in my code. So i
don't know what excel is doing...

Can someone please shed light on what is going on? or at least some
hints..

I turned off speech recognition, as this can cause weird focus issues,
but it makes no difference to me.
http://support.microsoft.com/kb/313176/en-us

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel losing focus, but remains active !

Not sure if this will of any help:

_Application objApp;
objApp.CreateDispatch(_T("Excel.Application"));
........
objApp.SetVisible(TRUE);
objApp.SetUserControl(TRUE);
objApp.ReleaseDispatch();
objApp.Quit();


"Nandan" wrote:

Hello,
I have written an excel add-in. The add-in has a C++ shim, and the UI
is in .NET.
In the add-in (C++ part) I use the ShowDialog method to display a
browser.
I pass the excel handle, as an argument to the ShowDialog method.


When i close the browser, Excel should regain focus and then for a
brief moment, it appears to do so..(i.e. the window title bar becomes
dark blue) but then focus dissapears (to i don't know where).

However excel is still the active application!
If i start typing immediately I can type fine inside excel, I can
access all of the menus, use the row keys to go up and down the
worksheet!
But the title bar is still a lighter shade of blue (as if it is not
the active application).

How is this even possible ? If i am typing in excel shouldnt this
window be the active window?

The window becomes "active" if i resize a column, or if i switch to an
other window and come back. or minimize and restore. Deleting data
does not seem to do it.

I have tried various things, such as setforegroundwindow, setFocus
etc.
The problem is, that the part where the window loses focus, is in the
Excel code, and occurs after my code has run. Its not in my code. So i
don't know what excel is doing...

Can someone please shed light on what is going on? or at least some
hints..

I turned off speech recognition, as this can cause weird focus issues,
but it makes no difference to me.
http://support.microsoft.com/kb/313176/en-us


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
ADDING/DELETING SHEET Without losing focus? Faraz A. Qureshi Excel Discussion (Misc queries) 1 July 29th 09 12:55 PM
Active Cell/Focus Rich W. Excel Discussion (Misc queries) 6 March 19th 08 04:59 PM
Make form active (set focus) Satish Excel Programming 8 November 27th 06 11:04 AM
Repost:Excel not active / loses focus.Pls help! michael.beckinsale Excel Programming 1 August 2nd 06 08:41 AM
Excel Remains Active in Windows Task Manager Philip Wybo Excel Programming 2 August 27th 03 09:30 AM


All times are GMT +1. The time now is 09:39 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"