password for a program

I was wondering how I could make a program that is protected with a password. So that you have to enter the password every time you use it. Thanks,
Rhiannon

Comments

  • : I was wondering how I could make a program that is protected with a password. So that you have to enter the password every time you use it. Thanks,
    : Rhiannon
    :
    There are many good examples on this board, but here is a very simple one:
    [code]
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    if Input('Password check','Enter password','')<>'password' then
    Close;
    end;
    [/code]
  • : I was wondering how I could make a program that is protected with a password. So that you have to enter the password every time you use it. Thanks,
    : Rhiannon
    :

    Try something like that:
    From File->New just add a PasswordDialog to your project (Borland put it there for this reason) and make it the default form for the project.
    Then choose a password for running the application, of the onclick event of the OKbtn of the password dialog write the followingcode:

    [blue]procedure [black]TPasswordDlg.OKBtnClick(Sender: TObject);
    [blue]begin
    if [black]password.Text <>[green]'password'[blue] then [blue]close
    [blue]else [blue]begin
    [black]PasswordDialog.Hide;
    Form1.Show;
    [blue]end;
    [blue]end;
    [black]
    (assuming that your current main form if Form1 and the password choosen is [red]password[black])
    Doing this, you can specify the passwordchar (*) for the password or make it invisible making the space it's passwordchar.
    I think that's it! If you encounter problems doing it just send me an e-mail ([email protected]). Good Luck!

  • Hi all and danmaftei,

    Just like to know whether we can change the password when the program is running. That is after the correct passwod had been entered. Then providing another option to change the current password so that when u log on next time, the new password will be in used.

    Don't know whether this is possible or not.

    Thanks

    Regards,
    Para

  • : Hi all and danmaftei,
    :
    : Just like to know whether we can change the password when the program is running. That is after the correct passwod had been entered. Then providing another option to change the current password so that when u log on next time, the new password will be in used.
    :
    : Don't know whether this is possible or not.
    :
    : Thanks
    :
    : Regards,
    : Para
    :
    :
    You can always save the password in a different file or in the registry. Then your program can update it whenever necessary.
  • mail me at
    [email protected]

    I'll send you the source af a component, written by me for my projects, wich do all that job for you.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories