Question

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?

Was it helpful?

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.

OTHER TIPS

Write to the beginning of the MSHTML_TLB.pas file this line (in bold):

unit MSHTML_TLB;
{$WARNINGS OFF}

and at the end:

{$WARNINGS ON}
end.

As a last resort, you can hide warnings. In Delphi 2010 this is in Project Options/Delphi Compiler/Hints and Warnings. I think this particular warning is "Redeclaration of a symbol hides a member in the base class".

Start up Delphi.

On the "Component" menu in the main toolbar select "Import ActiveX Control..." In the list box scroll and and select "Microsoft HTML Object Library".

The "Class names" should then list "TScriptlet".

Click "Install...", then click "OK" on the "Install" form that appears and "Yes" on the confirm prompt.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top