Too Many Actual Parameters (Message Dialogue)

1.3k views Asked by At

I have inherited a program that has a number of issues with it. The latest one is a Too Many Actual Parameters warning:

  if MessageDlgPos('IS THIS CORRECT? ' , mtConfirmation,
  **[mbyes, mbno], 0, 400, 450, mbno) = mrno then begin**
    edtPstvEmplyNmbr.SetFocus;
    xitFlg:= True;

The bold portion is where the error highlights.

Note: the program WORKS, just not on my machine. It was developed using the same version of Delphi (7), but in a clx (kylix) environment. I think I (may) have resolved all the incompatibility issues between clx and vcl (my current environment), but it may be that I'm missing a component that is generating this error. I will do my best to clarify any questions, but please remember I've only been developing Delphi for a matter of months.

1

There are 1 answers

2
Rob Kennedy On BEST ANSWER

Delphi's VCL and Kylix's CLX are not fully compatible. In particular, some like-named functions take different numbers of parameters, as you've learned first-hand.

Modern versions of Delphi support the version of MessageDlgPos that you're trying to call, but it's apparent that Delphi 7 does not. What probably happened was that CLX introduced the seven-argument overload when the VCL version only had six arguments, and then a later Delphi version ported the CLX version back to the VCL. Keep in mind that Delphi 7 is over a decade old.

To see which versions of the function are available to use, look in Dialogs.pas.

If you have the six-argument version, you might be able to simply remove the last parameter, and then just deal with the fact that the default button might not be what you want to be. Another alternative is to call MessageBox, which will let you specify the default button at the expense of being able to specify the window position.