Mega Code Archive

 
Categories / Delphi / Examples
 

Password to the application on start

Title: Password to the application on start Question: How to put password to the application on start. If someone want to open his application with password protection very easy way Answer: How to put password to the application on start It is very easy Just To your program create a form Password form After desing your form put such a code at the back of the onButtonclick procedure TPasForm.ButtonClick(Sender: TObject); var F1:Textfile; Name:string[20]; Pas:string[15]; begin try AssignFile(f1,'sys'); reset(f1); readln(f1,name); readln(f1,pas); if (adiedit.Text=name) and(pasedit.Text=pas) then close else Form1.Close; finally CloseFile(F1); end; end; then go to Application source code where it starts like program xxxxx; after uses declaration write this {$R *.RES} var Pas:TPasform; begin Application.Initialize; Application.CreateForm(TForm1, Form1); Pas:=TPasForm.Create(Application); Pas.Showmodal; Pas.Update; Application.Run; end; thats all I hope it will help you