Recent

Author Topic: Hello and HELP!! Error: Wrong number of parameters specified  (Read 5440 times)

Julcar

  • Newbie
  • Posts: 2
Hello and HELP!! Error: Wrong number of parameters specified
« on: August 15, 2017, 01:22:54 pm »
Hi everyone, I've just started with lazarus yesterday and I am a completely pascal newbie...

Anyway, I am trying to compile this delphi program:
https://www.ritlabs.com/en/products/tinyweb/download.php

It comes with the source code and is easy to unpack and test.

Well, after unpacking the source code I have in a folder a .dpr file which I converted through Lazarus in a .lpi file with the delphi -> free pascal converter, now lazarus lets me open the project.

Next I press ctrl+f9 and in the message log I get this error:
Code: [Select]
srvmain.pas(2010,52) Error: Wrong number of parameters specified for call to "<Procedure Variable>"

the line is this:

Code: [Select]
  if not ClassRegistered or (TempClass.lpfnWndProc <> @DefWindowProc) then

The main function where the line resides is as follow:

Code: [Select]
function AllocateHWnd(Method: TWndMethod): HWND;
var
  TempClass: TWndClass;
  ClassRegistered: Boolean;
begin
  UtilWindowClass.hInstance := HInstance;
  UtilWindowClass.lpfnWndProc := @DefWindowProc;
  ClassRegistered := GetClassInfo(HInstance, UtilWindowClass.lpszClassName,
    TempClass);
  if not ClassRegistered or (TempClass.lpfnWndProc <> @DefWindowProc) then
  begin
    if ClassRegistered then
      Windows.UnregisterClass(UtilWindowClass.lpszClassName, HInstance);
    Windows.RegisterClass(UtilWindowClass);
  end;
  Result := CreateWindowEx(WS_EX_TOOLWINDOW, UtilWindowClass.lpszClassName,
    '', WS_POPUP {!0}, 0, 0, 0, 0, 0, 0, HInstance, nil);
  if Assigned(Method) then
    SetWindowLong(Result, GWL_WNDPROC, Longint(MakeObjectInstance(Method)));
end; 

That is the only error I get at this time, so I think is possible to compile this program in Lazarus

Please help me to find the way, thanks.

Mr.Madguy

  • Hero Member
  • *****
  • Posts: 881
Re: Hello and HELP!! Error: Wrong number of parameters specified
« Reply #1 on: August 15, 2017, 01:34:42 pm »
First of all, does your project being compiled in Delphi mode? Try changing it via Project->Options->Parsing->Syntax mode or via {$mode delphi}. There may be many such errors, so it's better to fix them all at once. If it won't help - if I'm right, I guess you need to change this line into this
Code: Pascal  [Select][+][-]
  1.  if not ClassRegistered or (@TempClass.lpfnWndProc <> @DefWindowProc) then
  2.  
Is it healthy for project not to have regular stable releases?
Just for fun: Code::Blocks, GCC 13 and DOS - is it possible?

Thaddy

  • Hero Member
  • *****
  • Posts: 18963
  • Glad to be alive.
Re: Hello and HELP!! Error: Wrong number of parameters specified
« Reply #2 on: August 15, 2017, 02:04:26 pm »
Ok zero of all (you stole zero!)..
It depends on mode.
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

Julcar

  • Newbie
  • Posts: 2
Re: Hello and HELP!! Error: Wrong number of parameters specified
« Reply #3 on: August 15, 2017, 09:12:43 pm »
First of all, does your project being compiled in Delphi mode? Try changing it via Project->Options->Parsing->Syntax mode or via {$mode delphi}. There may be many such errors, so it's better to fix them all at once. If it won't help - if I'm right, I guess you need to change this line into this
Code: Pascal  [Select][+][-]
  1.  if not ClassRegistered or (@TempClass.lpfnWndProc <> @DefWindowProc) then
  2.  

Damnit! that @ before TempClass.lpfnWndProc did the trick!

As far as I remember, when Lazarus made the conversion from dpr to lpi, I selected an option to set the delphi mode in compilation time, now the code is compiled sucessfully, so much thanks!

 

TinyPortal © 2005-2018