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#
  4. How to know all windows are in minimized state

How to know all windows are in minimized state

Scheduled Pinned Locked Moved C#
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.
  • S Offline
    S Offline
    srikrishnathanthri
    wrote on last edited by
    #1

    Hello, I have a requirement of getting an event when all the Windows are in minimized state. How can I know when all other applications (except mine) are in minimized state using c#? Please help me.

    OriginalGriffO 1 Reply Last reply
    0
    • S srikrishnathanthri

      Hello, I have a requirement of getting an event when all the Windows are in minimized state. How can I know when all other applications (except mine) are in minimized state using c#? Please help me.

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      As far as I know there is no event that signals this - you can look at each window fairly easily though and enumerate those that are visible: List the currently running desktop windows in C# - C# HelperC# Helper[^] - a couple of small changes there would give you a list of "open" windows. But you'd have to check it periodically yourself. The other option is a lot more complex, and a lot more fraught with crash-and-burn potential: CBT Hooking. This entails adding a global hook to the system and watching for minimize, restore, and maximize events making their way through. You can do this in C# - though it's not simple - but it's not a trivial task (and I'd back up my PC before I started trying as you can seriously destabilize your system if you get it wrong). Google for "CBT Hooking C#" and you'll find info, if you are brave enough! [edit]Typo[/edit]

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      S 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        As far as I know there is no event that signals this - you can look at each window fairly easily though and enumerate those that are visible: List the currently running desktop windows in C# - C# HelperC# Helper[^] - a couple of small changes there would give you a list of "open" windows. But you'd have to check it periodically yourself. The other option is a lot more complex, and a lot more fraught with crash-and-burn potential: CBT Hooking. This entails adding a global hook to the system and watching for minimize, restore, and maximize events making their way through. You can do this in C# - though it's not simple - but it's not a trivial task (and I'd back up my PC before I started trying as you can seriously destabilize your system if you get it wrong). Google for "CBT Hooking C#" and you'll find info, if you are brave enough! [edit]Typo[/edit]

        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

        S Offline
        S Offline
        srikrishnathanthri
        wrote on last edited by
        #3

        I am new to c#. The example given by you gives some Titles which are running in system tray and some other titles also, I want window titles which are open but not in minimized state... can you help me where I need to edit the code ?

        OriginalGriffO 1 Reply Last reply
        0
        • S srikrishnathanthri

          I am new to c#. The example given by you gives some Titles which are running in system tray and some other titles also, I want window titles which are open but not in minimized state... can you help me where I need to edit the code ?

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          Just change the IsWindowVisible part to check if it's minimised with the IsIconic function (Windows)[^]

          Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          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