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 get the number of visible forms on screen ?

How to get the number of visible forms on screen ?

Scheduled Pinned Locked Moved C#
tutorialquestion
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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    How could I get the number of (local - belonging to the same application) forms on the screen ? There is a class Screen at System.Windows.Forms.Screen but it doesn't hold any variable of visible forms on the screen (of the current application). If the class has nothing to do with forms then why is it under the FORMS.Screen namespace at all, rather that just Windows.Screen ? Regards, Desmond

    V 1 Reply Last reply
    0
    • L Lost User

      How could I get the number of (local - belonging to the same application) forms on the screen ? There is a class Screen at System.Windows.Forms.Screen but it doesn't hold any variable of visible forms on the screen (of the current application). If the class has nothing to do with forms then why is it under the FORMS.Screen namespace at all, rather that just Windows.Screen ? Regards, Desmond

      V Offline
      V Offline
      Verdant123
      wrote on last edited by
      #2

      if i am not mistaken, there is nothing in "System.Windows" except the forms namespace... this is probably because the current .net windows gui system is called "Windows Forms" as to counting the number of open forms, why not either make an inheritable form with a counter to use in your applications, or increment and decrement a counter when you open/close forms.... other then that all i can think of is using EnumWindows in user32, and checking the window titles...

      L 1 Reply Last reply
      0
      • V Verdant123

        if i am not mistaken, there is nothing in "System.Windows" except the forms namespace... this is probably because the current .net windows gui system is called "Windows Forms" as to counting the number of open forms, why not either make an inheritable form with a counter to use in your applications, or increment and decrement a counter when you open/close forms.... other then that all i can think of is using EnumWindows in user32, and checking the window titles...

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        I think it's easier just to derive a class from System.Windows.Forms.Form, overload it's constructor and add there itself to a arraylist MyForms, or something like that. That way I also don't have to identify the forms (if they belong to me not another application on screen).

        V 1 Reply Last reply
        0
        • L Lost User

          I think it's easier just to derive a class from System.Windows.Forms.Form, overload it's constructor and add there itself to a arraylist MyForms, or something like that. That way I also don't have to identify the forms (if they belong to me not another application on screen).

          V Offline
          V Offline
          Verdant123
          wrote on last edited by
          #4

          sure it wasn't sure that was your goal :)

          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