Search code examples
delphigdi+gdidelphi-2007

Why class name of control is bad? Can not create new GDI handles?


I have a program create by Delphi language. This run on windows XP SP3.

After Open and stop program multi time (~600 to 700 times) (Only open and stop, does not do any thing). My program will be error:

  • Cannot input to text box of system.
  • Cannot click on some button.

When bug has occurred, the error will exist until the computer is restarted. (Restart program cannot resolve this bug)

I was check some information of system, and bellow is result:

  • Total GDI handles is less than GDI handles in normal: (Use GDIView to detect that)

    • case normal: 3513 GDI handles
    • when error occur: 3410
  • Class Name of control is bad: (Use spy++ detect)

    • Normal: Class name of text box is Tedit.

    • When error occur: "Toolbar_Customize" or "" or any value (This value is awlay change) ==> I think because that, i cannot input value to textbox.

Some time, i cannot start another program of windows when this bug occur.

Please help me. P/s: any unclear please comment


Solution

  • This reminds me of the following issue (Resource leak caused by RM_GetObjectInstance message): http://qc.embarcadero.com/wc/qcmain.aspx?d=90511

    There is a workaround in the last comment.