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. Who had focus. Any high level suggestion would be helpful.

Who had focus. Any high level suggestion would be helpful.

Scheduled Pinned Locked Moved C / C++ / MFC
comtutorial
2 Posts 2 Posters 6 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.
  • P Offline
    P Offline
    Phil McGahan
    wrote on last edited by
    #1

    I want to create an app that runs in the background most of the time. On rare occasions I want to display a modeless dialog for a short amount of time and then dismiss the dialog. This all seems easy enough to do. I would like some advice on how to place the focus back on the app or control that had focus before my dialog interrupted it. Any high level suggestion would be helpful. Thank you. PMCGAHAN@UCSWORKS.COM

    U 1 Reply Last reply
    0
    • P Phil McGahan

      I want to create an app that runs in the background most of the time. On rare occasions I want to display a modeless dialog for a short amount of time and then dismiss the dialog. This all seems easy enough to do. I would like some advice on how to place the focus back on the app or control that had focus before my dialog interrupted it. Any high level suggestion would be helpful. Thank you. PMCGAHAN@UCSWORKS.COM

      U Offline
      U Offline
      User 403
      wrote on last edited by
      #2

      If you haven't switched to any other windows, then it'll happen automatically when the dialog box is closed. That's the way Windows works and I advice that you let it work that way. If you want to override that behavior then before showing the dialog box, get the handle of the foreground window (using GetForegroundWindow) and then restore it when the dialog closes (SetForegroundWindow). Cheers! Alvaro

      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