Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ADDING/DELETING SHEET Without losing focus? | Excel Discussion (Misc queries) | |||
Active Cell/Focus | Excel Discussion (Misc queries) | |||
Make form active (set focus) | Excel Programming | |||
Repost:Excel not active / loses focus.Pls help! | Excel Programming | |||
Excel Remains Active in Windows Task Manager | Excel Programming |