visual cobol - error creating window handle - message

[Migrated content. Thread originally posted on 20 January 2012]


im starting to get a windows error message saying "error creating window handle" and after some googlerling found the following:-

it mentions this code:-

dim index as integer
for index = ctlFLP.Controls.count -1 to 0 step -1

But how do i cobolize it and where should i put it in my program.

pls help!

many thanks

  • This code is pretty specific to the example used in the articles.

    It shows how to dispose of child controls withing a panel control named ctlFLP which is being created dynamically on a Form.

    It just invokes the dispose method on each of the child controls on the panel in order to stop a handle leak condition that was occurring.

    It should be placed in a method that will be invoked when you are done using the panel control that is the parent to these child controls.

    The COBOL version of this would be:

           01 wsIndex   binary-long.     
           method-id disposeChildren.
           procedure division.
               perform varying wsIndex from ctlFLP::Controls::Count by -1
                  until wsIndex = 0
                  invoke ctlFLP::Controls::Item(wsIndex - 1)::Dispose

    But is this really the same problem that you are experiencing?

    Are you dynamically creating a lot of controls that are not being disposed of properly?
  • to be honest i dont know if thats the exact error im getting.

    i do have a jpeg image of the error but dont know how to post it on to this page?

    any ideas?


  • Verified Answer

    It would be best to open up a support incident for this as we will probably have to take a look at your actual application to determine exactly what is going on.

    Can you reproduce the error in a cutdown version of your application?
    Is the error sporadic in your application or can it be reproduced by following the same procedural steps to run it?

  • this error is just sporadic, cant be reproduced as its so random.

    i have no idea whats causing it, which is why i googled it, and was surprised to see other visual studio users were getting same sort of problems.
  • Can you please send the error .jpg to me at

    A stack trace would also be helpful if it is being produced.