在口令設置窗口中
procedure TSetPassWordForm
begin
if Edit
if Key = #
begin
if Verified then
if StrPas(PassWord) = Edit
begin
OKBtn
Edit
OKBtn
end
else
begin
Verified := False;
MessageDlg(
Edit
PassWord :=
Label
end
else
begin
Verified := True;
StrPCopy(PassWord
Edit
Label
end;
Key := #
end;
end;
口令檢查窗口的實現相對簡單
function GetPassword(Password: PChar)
var
GetPasswordForm: TGetPasswordForm;
begin
Result := False;
GetPasswordForm := TGetPasswordForm
try
with GetPasswordForm do
if ShowModal = mrOK then
if UpperCase(Edit
MessageDlg(
else
Result := True;
finally
PasswordForm
end;
end;
PassWord為輸入的參數
窗口中用戶輸入口令時回顯在屏幕上的字符由編輯框的PassWordChar屬性確定
在DLLs的工程文件中
library PassForm;
uses
GetPass in
Setpass in
exports
GetPassword
begin
end
在Delphi應用程序中調用重用窗體
function GetPassword(Password: PChar)
far; external
function SetPassword(PassWord: PChar)
far; external
這位於程序單元的implementation部分
[
From:http://tw.wingwit.com/Article/program/Delphi/201311/25205.html