錯誤:對實際的和正式變種參數類型必須是相同的如何解決命名和範圍衝突?
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.
總是誤差函數doKeyPress(米); 一個簡單的問題,爲什麼?
我知道類型有問題,但所有類型都是類似的,無處不在的字節,奇怪的 對我來說我無法運行一個程序。
謝謝。現在好了! – 2012-01-01 19:10:48