把代码放在工程文件中,算了,我给你一个例子。看好了: program Initialize;uses Forms, Dialogs, Controls, MainFrm in 'MainFrm.pas' {MainForm};{$R *.RES}var Password: String; begin if InputQuery('Password', 'Enter your password', PassWord) then if Password = 'D5DG' then begin // Other initialization routines can go here. Application.CreateForm(TMainForm, MainForm); Application.Run; end else MessageDlg('Incorrect Password, terminating program', mtError, [mbok], 0); end.
program Initialize;uses
Forms,
Dialogs,
Controls,
MainFrm in 'MainFrm.pas' {MainForm};{$R *.RES}var
Password: String;
begin
if InputQuery('Password', 'Enter your password', PassWord) then
if Password = 'D5DG' then
begin
// Other initialization routines can go here.
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end
else
MessageDlg('Incorrect Password, terminating program', mtError, [mbok], 0);
end.
放在Create或OnShow我感觉是不大好!!!
这个东西与做启动封面(Splash--闪屏)是一个原理!