unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
IU=Interface(IUnKnown)
procedure ShowMyMessage(Str:String);
end; TForm1 = class(TForm,IU)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
procedure ShowMyMessage(Str:String);
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.ShowMyMessage(Str:String);
begin
MessageBox(0,PChar(Str),'提示',MB_OK);
end;procedure TForm1.Button1Click(Sender: TObject);
var
MM:IU;
begin
MM.ShowMyMessage('接口试验程序');
end;end.这个程序为什么会在运行期间出错呢????请帮我
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
IU=Interface(IUnKnown)
procedure ShowMyMessage(Str:String);
end; TForm1 = class(TForm,IU)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
procedure ShowMyMessage(Str:String);
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.ShowMyMessage(Str:String);
begin
MessageBox(0,PChar(Str),'提示',MB_OK);
end;procedure TForm1.Button1Click(Sender: TObject);
var
MM:IU;
begin
MM.ShowMyMessage('接口试验程序');
end;end.这个程序为什么会在运行期间出错呢????请帮我
var
MM:IU;
begin
MM := Self;
if Assigned(MM) then
MM.ShowMyMessage( '接口试验程序 ');
end;
if Supports(Self, IU, MM) then
MM.ShowMyMessage('接口试验程序');