Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7004013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:08:38+00:00 2026-05-27T21:08:38+00:00

Error: Types of actual and formal var parameters must be identical unit unAutoKeypress; interface

  • 0

Error: Types of actual and formal var parameters must be identical

unit unAutoKeypress;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Button1: TButton;
    Memo2: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
procedure SimulateKeyDown(Key:byte);
begin
keybd_event(Key,0,0,0);
end;

procedure SimulateKeyUp(Key:byte);
begin
keybd_event(Key,0,KEYEVENTF_KEYUP,0);
end;

procedure doKeyPress(var KeyValue:byte);
begin
 SimulateKeyDown(KeyValue);
 SimulateKeyUp(KeyValue);
end;



procedure TForm1.Button1Click(Sender: TObject);
const test = 'merry Christmas!';
var m: byte;
begin
Memo2.SetFocus();
m:=$13;
doKeyPress(m); // THIS IS WHERE ERROR
end;

end.

always error in function doKeyPress(m);
a simple question, why?

I know something wrong with types, but all types are similar, everywhere is byte, strange
for me and I cant run a program.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:08:38+00:00Added an answer on May 27, 2026 at 9:08 pm

    The problem is that doKeyPress is a method of TForm1 (inherited from TWinControl) and so when you write doKeyPress inside a TForm1 method the compiler wants to use TForm1.doKeyPress rather than the local function. The class scope is nearer than the local function scope.

    Possible solutions include:

    • Renaming the local function to avoid the clash.
    • Using a fully qualified name, unAutoKeypress.doKeyPress.

    The former is a better solution in my opinion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my manifest file which shows error string types not allowed at android:configChanges
The code below gives me the following error: incompatible types when assigning to type'char[10]'
I get the following error: One or more types required to compile a dynamic
I keep getting this stored procedure error (wrong number or types of the arguments)
In D2010, Error Insight is incorrectly underlining in red types like TOpenDialog (even though
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> void error(char *msg) {
Good Day Everyone... I’m getting an unexpected WCF error complaining of Known Types which
My code: CGPoint *tp_1 = CGPointMake(160, 240); gives an Incompatible types in initialization error...
I keep getting the error: Type was not found or was not a compile-time
Can someone please explain why I'm getting this error Type mismatch: cannot convert from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.