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. How to set focus on the next window after minimizing ?

How to set focus on the next window after minimizing ?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
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.
  • Y Offline
    Y Offline
    Yovav
    wrote on last edited by
    #1

    How can I set the focus to the next open window after I minimize some other window ? For example: I have the following apps open: IE, Word, Notepad When I minimize - Notepad is going to the task bar, At this point I lose the focus and the other open windows cannot be minimized (My program do minimize the current window in focus when I click something) This is what I tried: GetForegroundWindow()->ShowWindow(SW_SHOWMINIMIZED); Sleep(1000); // Let it minimize ? ::GetWindow(GetForegroundWindow()->m_hWnd, GW_HWNDNEXT); Any ideas ?

    Best Regards - Yovav Gad CEO and founder of MicroMighty, Inc.

    Y 1 Reply Last reply
    0
    • Y Yovav

      How can I set the focus to the next open window after I minimize some other window ? For example: I have the following apps open: IE, Word, Notepad When I minimize - Notepad is going to the task bar, At this point I lose the focus and the other open windows cannot be minimized (My program do minimize the current window in focus when I click something) This is what I tried: GetForegroundWindow()->ShowWindow(SW_SHOWMINIMIZED); Sleep(1000); // Let it minimize ? ::GetWindow(GetForegroundWindow()->m_hWnd, GW_HWNDNEXT); Any ideas ?

      Best Regards - Yovav Gad CEO and founder of MicroMighty, Inc.

      Y Offline
      Y Offline
      Yovav
      wrote on last edited by
      #2

      OK, I partially managed to do it with the following code: GetForegroundWindow()->ShowWindow(SW_SHOWMINIMIZED); CWnd* pCurrentWindow; POINT pt; GetCursorPos(&pt); pCurrentWindow = WindowFromPoint(pt); pCurrentWindow->SetForegroundWindow(); The problem is that it will only get the focus of windows behind the cursor (mouse) Any idea how to get the next window regardless to the cursor location ?

      Best Regards - Yovav Gad CEO and founder of MicroMighty, Inc.

      modified on Saturday, April 25, 2009 6:11 AM

      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