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. Return to the previous active window?

Return to the previous active window?

Scheduled Pinned Locked Moved C / C++ / MFC
performancehelpquestion
2 Posts 1 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
    Matt Eckerson
    wrote on last edited by
    #1

    Hi all, I have a dialog that pops up every hour or so, and I'd like it to return to the previous active window after the user clicks OK on the dialog. I've got a HWND member variable that gets the previous active window in PreCreateWindow, and a SetActiveWindow function in the PostNcDestroy of the popup dialog class. I'm not sure about where else to put these functions, --and it does bomb with an error, "...memory could not be read." Could someone point me in the right direction? Where's the best place to do this? Thanks in advance. Matt

    M 1 Reply Last reply
    0
    • M Matt Eckerson

      Hi all, I have a dialog that pops up every hour or so, and I'd like it to return to the previous active window after the user clicks OK on the dialog. I've got a HWND member variable that gets the previous active window in PreCreateWindow, and a SetActiveWindow function in the PostNcDestroy of the popup dialog class. I'm not sure about where else to put these functions, --and it does bomb with an error, "...memory could not be read." Could someone point me in the right direction? Where's the best place to do this? Thanks in advance. Matt

      M Offline
      M Offline
      Matt Eckerson
      wrote on last edited by
      #2

      Found that

      ::SetForegroundWindow(hwnd);

      seems to work. Just didn't look deep enough. Sometimes things are staring you right in the face and you don't even realize it. :mad: Matt

      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