ActiveForm新增屬性和事件,為何編譯出錯?該如何修改? |
尚未結案
|
yzml
一般會員 發表:4 回覆:4 積分:1 註冊:2004-12-26 發送簡訊給我 |
我增加了屬性ServerName和事件OnTestEnd,但編譯時出錯,明明這屬性和事件在Type Library中已經定義,為什麼還出錯呢?該如何修改? =============================================================
YzFTPImpl.pas
=============================================================
unit YzFTPImpl; {$WARN SYMBOL_PLATFORM OFF} interface uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ActiveX, AxCtrls, YzFTP_TLB, StdVcl; type
TYzFTP = class(TActiveForm, IYzFTP)
private
{ Private declarations } FEvents: IYzFTPEvents;
procedure TestEndEvent(Sender: TObject); protected
{ Protected declarations }
procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
procedure EventSinkChanged(const EventSink: IUnknown); override; function Get_ServerName: WideString; safecall;
procedure Set_ServerName(const Value:WideString); safecall;
public
{ Public declarations }
procedure Initialize; override; end; implementation uses ComObj, ComServ; {$R *.DFM} { TYzFTP } procedure TYzFTP.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
begin
{ Define property pages here. Property pages are defined by calling
DefinePropertyPage with the class id of the page. For example,
DefinePropertyPage(Class_YzFTPPage); }
end; procedure TYzFTP.EventSinkChanged(const EventSink: IUnknown);
begin
FEvents := EventSink as IYzFTPEvents;
inherited EventSinkChanged(EventSink);
end; procedure TYzFTP.Initialize;
begin
inherited Initialize;
OnTestEnd := TestEndEvent;
end; function TYzFTP.Get_ServerName: WideString;
begin
Result := WideString(ServerName);
end; procedure TYzFTP.TestEndEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnTestEnd;
end; procedure TYzFTP.Set_ServerName(const Value: WideString);
begin
ServerName := Value;
end; initialization
TActiveFormFactory.Create(
ComServer,
TActiveFormControl,
TYzFTP,
Class_YzFTP,
1,
'',
OLEMISC_SIMPLEFRAME or OLEMISC_ACTSLIKELABEL,
tmApartment);
end.
==============================================================
Error.TXT
==============================================================
Build
[Error] YzFTPImpl.pas(x1x): Undeclared identifier: 'OnTestEnd'
[Error] YzFTPImpl.pas(x2x): Not enough actual parameters
[Error] YzFTPImpl.pas(x3x): Undeclared identifier: 'ServerName'
[Error] YzFTPImpl.pas(x4x): Undeclared identifier: 'ServerName'
[Fatal Error] YzFTP.dpr(6): Could not compile used unit 'YzFTPImpl.pas'
|
ddy
站務副站長 發表:262 回覆:2105 積分:1169 註冊:2002-07-13 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |