利用DLLs實現窗體重用的步驟是
(
(
(
(
重用窗體的調用同一般DLLs函數或過程的調用完全一致
下面我們通過一個具體的實例來說明窗體重用的設計過程
窗體重用DLLs的設計依照(
窗體類TSetPassWordForm定義了兩個數據成員Verified和PassWord
type
TSetPassWordForm = class(TForm)
Label
Edit
OKBtn: TBitBtn;
CancelBtn: TBitBtn;
procedure FormCreate(Sender: TObject)
procedure Edit
private
{ Private declarations }
Verified: Boolean;
public
{ Public declarations }
PassWord: PChar;
end;
窗口生成時
procedure TSetPassWordForm
begin
Verified := False;
PassWord := StrAlloc(
OKBtn
Label
end;
按鈕OKBtn在程序啟動時Enabled屬性設置為False
在口令設置代碼單元中定義了一個輸出函數SetPassWord
function SetPassWord(PWord: PChar)
var
SetPassWordForm: TSetPassWordForm;
begin
Result := False;
SetPassWordForm := TSetPassWordForm
try
with SetPasswordForm do
if ShowModal = mrOK then
begin
StrCopy(PWord
Result := True;
end;
finally
SetPasswordForm
end;
end;
口令成功設置
[
From:http://tw.wingwit.com/Article/program/Delphi/201311/25204.html