Easy peasy...

How can I make a form, that is only created when I want to display it.  I only want this so that when I password protect a program, another program cannot find the window, and send some message to it to activate.  Then, when I close it, it is destroyed again.

P.S I have D3
LVL 1
bogieman_Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vladikaCommented:
Try this:
select from menu Project\Options
select Forms page
move your form from auto-create forms list to available forms list.
Now your form will not created at startup.
When you want to use your form you can write:
  with TPasswordForm.Create(Application) do // create it by request
  try
    ShowModal; // show your form
  finally
    Free; // and after all free it
  end;

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
intheCommented:
you can also get input from a user by using the InputQuery() api like so:

var
   s:string;
   b:boolean;
 begin
   b:= InputQuery('Password',
      'please enter your password...', s);

   if b
     then begin
   ShowMessage('entered ,'+s);
   if s = 'the correct password' then
 //let them in
 end
 else if s <> 'the correct password' then
 //dont let them in (a close maybe)

    else ShowMessage('cancel button clicked...');
 end;

thats untested code but gives the idea ..
Regards Barry
0
vladikaCommented:
Usually when user enters password it is  protected by '*' char.
Unfortantly InputQuery cannot hide user input with '*' :)
0
bogieman_Author Commented:
Cheers, worked like a dream - well not a dream but...quite well.  Yeah, that'll do - "It worked quite well"
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.