Board index » delphi » Automatically closing a program

Automatically closing a program

I am trying to get my program to shutdown when an invalid code is entered
but I can't seem to do it without causing a GPF.

Firstly I created my own form in the main forms' OnActivate method, making
sure it only runs once. Various attempts didn't work so then I moved the
check into a timer which executes a second after the program starts ....
same problem. Originally I thought creating my form manually within the
OnActivate or Timer was causing the problem but a simple ShowMessage causes
the GPF as soon as the dialogue box is cancelled.

Is there a best way to display a form when the program runs that can then
close the program if the correct information isn't given ? (Delphi 1)

Cheers,
Terry

 

Re:Automatically closing a program


Quote
Terry King wrote in message <01bd9c36$3ceeec60$b538a8c2@TERRY>...
>I am trying to get my program to shutdown when an invalid code is entered
>but I can't seem to do it without causing a GPF.

<snip>
>Is there a best way to display a form when the program runs that can then
>close the program if the correct information isn't given ? (Delphi 1)

How are you shutting down the program? Are you using Application.Terminate?
Are you trying to create a password form?

        -- Kirk

Re:Automatically closing a program


Maybe you should set the application mainform proerty to the id of you form
so that it is always created fist, then use application.terminate if someone
enters an invalid code

Lee

Quote
Terry King wrote in message <01bd9c36$3ceeec60$b538a8c2@TERRY>...

snip

Re:Automatically closing a program


What is the code?, is this a login sequence, a command line prompt?
Depending on what you are trying to do, try using a try..except handler
in the application source code.

Quote
Terry King wrote:

> I am trying to get my program to shutdown when an invalid code is entered
> but I can't seem to do it without causing a GPF.

> Firstly I created my own form in the main forms' OnActivate method, making
> sure it only runs once. Various attempts didn't work so then I moved the
> check into a timer which executes a second after the program starts ....
> same problem. Originally I thought creating my form manually within the
> OnActivate or Timer was causing the problem but a simple ShowMessage causes
> the GPF as soon as the dialogue box is cancelled.

> Is there a best way to display a form when the program runs that can then
> close the program if the correct information isn't given ? (Delphi 1)

> Cheers,
> Terry

Other Threads