Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Focusless window - how to make that?

Focusless window - how to make that?

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++comtutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    midix
    wrote on last edited by
    #1

    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)

    M 1 Reply Last reply
    0
    • M midix

      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)

      M Offline
      M Offline
      mbue
      wrote on last edited by
      #2

      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;

      M 1 Reply Last reply
      0
      • M mbue

        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;

        M Offline
        M Offline
        midix
        wrote on last edited by
        #3

        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

        M 1 Reply Last reply
        0
        • M midix

          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

          M Offline
          M Offline
          mbue
          wrote on last edited by
          #4

          No I have no other idea. You can try to disable the window to prevent it from getting focus (EnableWindow(hwnd,0);).

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups