Focusless window - how to make that?
-
MFC is so full of capabilities that I am a bit confused in the documentation and help files and cannot find the solution. The problem: I have a simple CDialog based app window with an ActiveX control in it. This ActiveX control has a feature that I do not need at all: it makes the dialog box jump in the foreground sometimes. Even if I hide the window (ShowWinow(SW_HIDE)), my app steals the input focus. It is normal behaviour for that ActiveX control and I do not want (and can't) modify the ActiveX control. But I want to make my app "focusless" - that means if it receives some message to activate or jump foreground or capture keyboard and mouse focus, it should not respond. Have tried OnActivate, OnActivateApp, OnNcActivate, OnSetFocus, but these handlers are triggered AFTER the actual event and this does not work for me. I even agree to have this window to be invisible all the time (or maybe you know how to get ActiveX work without any window at all? , it just needs to be silent in the background until it does what it has to do and then exits. Any ideas? Thanks (at least for reading this)
-
MFC is so full of capabilities that I am a bit confused in the documentation and help files and cannot find the solution. The problem: I have a simple CDialog based app window with an ActiveX control in it. This ActiveX control has a feature that I do not need at all: it makes the dialog box jump in the foreground sometimes. Even if I hide the window (ShowWinow(SW_HIDE)), my app steals the input focus. It is normal behaviour for that ActiveX control and I do not want (and can't) modify the ActiveX control. But I want to make my app "focusless" - that means if it receives some message to activate or jump foreground or capture keyboard and mouse focus, it should not respond. Have tried OnActivate, OnActivateApp, OnNcActivate, OnSetFocus, but these handlers are triggered AFTER the actual event and this does not work for me. I even agree to have this window to be invisible all the time (or maybe you know how to get ActiveX work without any window at all? , it just needs to be silent in the background until it does what it has to do and then exits. Any ideas? Thanks (at least for reading this)
-
On WM_WINDOWPOSCHANGING examine the WINDOWPOS* pointer in the LPARAM and set the flags member always on SWP_NOZORDER.
case WM_WINDOWPOSCHANGED: case WM_WINDOWPOSCHANGING: { WINDOWPOS* wp=(WINDOWPOS*)lParam; wp->flags |= SWP_NOZORDER; } break;
Thanks a lot! I knew that the solution is simple just did not want to try out all of message handlers available; so your help eased my life a lot :) -- modified at 11:42 Tuesday 28th February, 2006 Oops! That does not work. Seems that ActiveX control is stronger - I completely hide my window and try filter with SWP_NOACTIVATE but nothing. Maybe if I tell that ActiveX control is WebBrowser that would give you some more ideas? Thanks
-
Thanks a lot! I knew that the solution is simple just did not want to try out all of message handlers available; so your help eased my life a lot :) -- modified at 11:42 Tuesday 28th February, 2006 Oops! That does not work. Seems that ActiveX control is stronger - I completely hide my window and try filter with SWP_NOACTIVATE but nothing. Maybe if I tell that ActiveX control is WebBrowser that would give you some more ideas? Thanks