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 find the number of current window handles for a/my process. [modified]

How to find the number of current window handles for a/my process. [modified]

Scheduled Pinned Locked Moved C#
helpcsharpcssgraphicsjson
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.
  • M Offline
    M Offline
    Martin 0
    wrote on last edited by
    #1

    Hello community, My problem is a Win32Exception, "Error creating window handle". I know, normally it's a sign of a bad designed GUI if this happens. (Maybe also here, who knows) But, I have a projects where a lot of controls on seperate UserControls and TabPages, have to stay in memory for the whole time. This is like it is and can not be changed. If I step threw all my GUI-"pages", at some point it crashes. I did some tests and can say, that it is not a problem of: too less memory too high GDI objects (which are normaly limited to 10000, but can also be set higher) I'm using a lot of selfe designed UserControls, which of corse can be redisigned in some cases. Maybe if I do some changes there I could kill some subControls (1000-2000). But this would mean that I'm always on the limit. So I would like to have a method which allows me to find the big "handle eater" in my project first. I'm also not sure if it is correct that the limit of max window handles in WinXP is fix 16bit, and can not be modified. Thanks for suggestions! Upps: Forgot to tell you, that I'm using .Net1.1, but I'm sure it will only be possible over an API. -- modified at 5:12 Friday 14th September, 2007 Also Note: The Controls and Pages are in memory from beginning (start) of the application. So stepping threw my pages are not effecting the used memory in any way.

    All the best, Martin

    M 1 Reply Last reply
    0
    • M Martin 0

      Hello community, My problem is a Win32Exception, "Error creating window handle". I know, normally it's a sign of a bad designed GUI if this happens. (Maybe also here, who knows) But, I have a projects where a lot of controls on seperate UserControls and TabPages, have to stay in memory for the whole time. This is like it is and can not be changed. If I step threw all my GUI-"pages", at some point it crashes. I did some tests and can say, that it is not a problem of: too less memory too high GDI objects (which are normaly limited to 10000, but can also be set higher) I'm using a lot of selfe designed UserControls, which of corse can be redisigned in some cases. Maybe if I do some changes there I could kill some subControls (1000-2000). But this would mean that I'm always on the limit. So I would like to have a method which allows me to find the big "handle eater" in my project first. I'm also not sure if it is correct that the limit of max window handles in WinXP is fix 16bit, and can not be modified. Thanks for suggestions! Upps: Forgot to tell you, that I'm using .Net1.1, but I'm sure it will only be possible over an API. -- modified at 5:12 Friday 14th September, 2007 Also Note: The Controls and Pages are in memory from beginning (start) of the application. So stepping threw my pages are not effecting the used memory in any way.

      All the best, Martin

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      Hi! You can p/invoke GetGuiResources() function from user32.dll to receive the number of GDI and USER objects currently used.

      Regards, mav -- Black holes are the places where God divided by 0...

      M 2 Replies Last reply
      0
      • M mav northwind

        Hi! You can p/invoke GetGuiResources() function from user32.dll to receive the number of GDI and USER objects currently used.

        Regards, mav -- Black holes are the places where God divided by 0...

        M Offline
        M Offline
        Martin 0
        wrote on last edited by
        #3

        Hello mav, Thanks a lot for you time! I will test the Method as soon as I'm back in office and let you know if it helped me! But from what I could found out of the documentation[^], it looks very promising! So thank you very much! Got my '5'!

        All the best, Martin

        1 Reply Last reply
        0
        • M mav northwind

          Hi! You can p/invoke GetGuiResources() function from user32.dll to receive the number of GDI and USER objects currently used.

          Regards, mav -- Black holes are the places where God divided by 0...

          M Offline
          M Offline
          Martin 0
          wrote on last edited by
          #4

          Hello mav, Here is my status from today: http://www.codeproject.com/script/comments/forums.asp?forumid=1649&mpp=50&select=2233886&msg=2233886[^] Again, thank you very much!

          All the best, Martin

          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