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. Error creatin window handle

Error creatin window handle

Scheduled Pinned Locked Moved C#
csharphelptutorialquestion
6 Posts 3 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.
  • E Offline
    E Offline
    eoe
    wrote on last edited by
    #1

    Hi In recent times I often get an application error that it is impossible to create a new control object, because there are no more window handles left. The application is written in C# (.Net 1.1) and is used to create extensive content specific dialogues. At the moment I’m not quite sure how to identify the source of error. Within my object model, I use every time dispose() to destroy any existing graphical object. But it seems that this process doesn’t work correct. It is possible to retrieve the number of window handles that are currently used by an application? Last week I read a thread that states to locate the application process and then use the MainWindowHandle property in relation with EnumWindows to get the total count of all window handles. Unfortunately, I’ have no idea how to implement this procedure (especially how shall I use EnumWindows). Does anyone knows how to perform this task or does anyone have another idea to determine the total count of used window handles? Thanks in advance Erik

    J M 2 Replies Last reply
    0
    • E eoe

      Hi In recent times I often get an application error that it is impossible to create a new control object, because there are no more window handles left. The application is written in C# (.Net 1.1) and is used to create extensive content specific dialogues. At the moment I’m not quite sure how to identify the source of error. Within my object model, I use every time dispose() to destroy any existing graphical object. But it seems that this process doesn’t work correct. It is possible to retrieve the number of window handles that are currently used by an application? Last week I read a thread that states to locate the application process and then use the MainWindowHandle property in relation with EnumWindows to get the total count of all window handles. Unfortunately, I’ have no idea how to implement this procedure (especially how shall I use EnumWindows). Does anyone knows how to perform this task or does anyone have another idea to determine the total count of used window handles? Thanks in advance Erik

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      Let's first understand the problem. You can't create new controls because you've used up all 10,000 window handles allocated to your process[^]? Is that what's happening?

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: Sound The Great Shofar! The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

      E 1 Reply Last reply
      0
      • E eoe

        Hi In recent times I often get an application error that it is impossible to create a new control object, because there are no more window handles left. The application is written in C# (.Net 1.1) and is used to create extensive content specific dialogues. At the moment I’m not quite sure how to identify the source of error. Within my object model, I use every time dispose() to destroy any existing graphical object. But it seems that this process doesn’t work correct. It is possible to retrieve the number of window handles that are currently used by an application? Last week I read a thread that states to locate the application process and then use the MainWindowHandle property in relation with EnumWindows to get the total count of all window handles. Unfortunately, I’ have no idea how to implement this procedure (especially how shall I use EnumWindows). Does anyone knows how to perform this task or does anyone have another idea to determine the total count of used window handles? Thanks in advance Erik

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

        Hi! There's a thread on this topic a few entries down the page: here

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

        E 1 Reply Last reply
        0
        • J Judah Gabriel Himango

          Let's first understand the problem. You can't create new controls because you've used up all 10,000 window handles allocated to your process[^]? Is that what's happening?

          Tech, life, family, faith: Give me a visit. I'm currently blogging about: Sound The Great Shofar! The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

          E Offline
          E Offline
          eoe
          wrote on last edited by
          #4

          That’s right. In my opinion, I have used up all window handles. It doesn’t happen at once, but it is an ongoing process. It seems that I don’t destroy every created control. Therefore an advisor can process normally a lot of orders, before the error occurs.

          1 Reply Last reply
          0
          • M mav northwind

            Hi! There's a thread on this topic a few entries down the page: here

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

            E Offline
            E Offline
            eoe
            wrote on last edited by
            #5

            Hi, thanks for the excellent link. This is exactly what I was looking for. Using GetGuiResources shows that even if I dispose (or I think that I dispose them) the gui objects, not all used window handles were disposed. Just to give a small example: Before opening an order : 204 / 375 After opening an order : 370 / 1988 After closing an order : 267 / 699 I guess that if everything would work correct the total numbers of available gui handles after closing an order should be the same as before opening the order. Is there any way to detect this memory leak? Regards Erik

            J 1 Reply Last reply
            0
            • E eoe

              Hi, thanks for the excellent link. This is exactly what I was looking for. Using GetGuiResources shows that even if I dispose (or I think that I dispose them) the gui objects, not all used window handles were disposed. Just to give a small example: Before opening an order : 204 / 375 After opening an order : 370 / 1988 After closing an order : 267 / 699 I guess that if everything would work correct the total numbers of available gui handles after closing an order should be the same as before opening the order. Is there any way to detect this memory leak? Regards Erik

              J Offline
              J Offline
              Judah Gabriel Himango
              wrote on last edited by
              #6

              Microsoft has a free tool called the CLR Profiler that can alert you to memory leaks. Commercial apps such as Ants Profiler also can alert you to memory leaks.

              Tech, life, family, faith: Give me a visit. I'm currently blogging about: Sound The Great Shofar! The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

              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