vas
vas

Reputation: 2096

Trouble with THTML file GDIPL2A.pas

Running a project and was getting an error saying
"Not enough actual parameters" The error is in "C:\Program Files\PBear\HTMLComponents\package\GDIPL2A.pas". The mistake pointed three times to "inherited Create;" lines 260,270 and 278 . In the file "GDIPL2A.pas".the Code is:-

var
  err: integer;
begin
inherited Create;
err := GdipCreateBitmapFromScan0(W, H, 0, PixelFormat32bppARGB, nil, fHandle);
if err <> 0 then
  raise EGDIPlus.Create('Can''t create bitmap');
end;

I was wondering why it would show an error in "THTML" files, WHICH ARE NOTHING BUT FILES FROM THE INSTALLATION of THTML.I did not even touch THTML files.

Kindly help

Thanks and Regards

Vas

Upvotes: 0

Views: 367

Answers (3)

Erling Myren
Erling Myren

Reputation: 1

I don't know if anybody read this anymore but my problem occurred during installing of ThtmlViewer. My solution was to edit the GDIPL2A.pas file. I just added an emty string and a false boolean, so the 3 create statements looked like this:

   inherited Create('', False);

And then everything worked fine (at least so far)

(I have an old Delphi 4 on an old Windows Xp on an old PC, not connected to internet)

Kindly

Erling

Upvotes: 0

Ken White
Ken White

Reputation: 125708

I have THTML, and it indeed includes GDIPL2A.pas, which is a wrapper around GDIPlus; apparently THTML uses GDIPlus to display embedded images or something.

A quick look at the declaration of TGPImage and TGpBitmap shows the constructor declarations of each:


// TGpImage
public
  constructor Create(FileName: string; TmpFile: boolean = False); overload;
  constructor Create(IStr: IStream); overload;

// TGpBitmap
public
  constructor Create(W, H: Integer); overload;
  constructor Create(IStr: IStream); overload;

You'll see that all of the constructors takes at least one or two parameters; your call to inherited Create passes none. However, since the call to inherited is in another constructor it should work (and indeed does on my machine; I just tried rebuilding one of the demos from THTML and it recompiled GDIPL2A.pas fine), You've got something else going on, like a different version of GDIPL2A in your path that the compiler is using instead of the one you're seeing in the IDE's editor.

As to your question, I answered it in the first paragraph above. It's reporting the error in THTML because that's the copy of GDIPL2A that the compiler is using, which may not be the one your code is expecting it to use.

You can fix that by either:

  1. Reordering units in the uses clause of your code so that all calls that cause GDIPL2A to compile are using the same one;

  2. Copy the GDIPL2A your code thinks it's using into your project's source folder, so it will be compiled from there. This will probably break THTML if you're using it in that same project, so be ready for that;

  3. Find and resolve the competing copies of GDIPL2A so that there's only one copy available on the compiler's search path;

  4. Remove the THTML path from your project's search and library paths, if you're not using it in your problem project. You can also, using Project|Options|Packages, prevent THTML from even being loaded when you open the project if you'd like, to make your project load faster.

Upvotes: 1

Mason Wheeler
Mason Wheeler

Reputation: 84550

A "Not enough actual parameters" error on "inherited Create;" means that you're trying to call an inherited constructor but it not supplying any parameters. Check the class you're inheriting from and you'll see a Create that requires some parameters. (If the base class doesn't have one, check its parent, and its parent and so on. You'll find one eventually.) It should be pretty obvious once you find the constructor declaration what you need to pass to it.

Your call needs to look something like:

inherited Create(param1, param2);

Upvotes: 1

Related Questions