Search code examples
delphidelphi-2009typelib

Why does MSHTML_TLB.pas produce warnings?


I am trying to get rid of lots of warnings in a project after converting it from BDS 2006 to Delphi 2009.

The project needs a type library named MSHTML_TLB. The source file mshtml_tlb.pas is an incredibly large file (about 16MB and >440.000 lines of code) which is generated when the Type Library is imported into Delphi 2009.

This file produces many warnings when building the project:
W1010 Method 'ToString' hides virtual method of base type 'TObject'

Since Delphi itself has created that file, I am wondering why these warnings come up and if I should just ignore them? If so, is there a way to disable this kind of warning just for this file?


Solution

  • Delphi introduced this virtual method in TObject. Your declaration of ToString in a derived class does not use override so the ToString method of TObject is not accessible anymore. Adding override to your ToString method should solve the problem unless you declared your method differently.