Discussion:
A (possibly) windowless program and more
(too old to reply)
Stark
2010-10-07 09:36:32 UTC
Permalink
I need a program that does the following:
At Windows start, checks if conditions are met for some alarm to be issued.
If conditions are not met, the program is terminated (and the user will not
see it). Otherwise, the user is offered an option to open a second program
to handle some tasks. In any case the first program should be terminated.
Is it possible to do this ? I have doubts on several points:
1-The first program is possibly a windowless programm. Only if conditions
are met a window is needed. How do I do this?
2-The second program may be launched by the first. Does this mean that the
first is kept opne until the second is closed? Or there is a way to
terminate the first program before starting execution of the second ?
Maarten Wiltink
2010-10-07 16:59:59 UTC
Permalink
Post by Stark
At Windows start, checks if conditions are met for some alarm to be
issued. If conditions are not met, the program is terminated (and the
user will not see it). Otherwise, the user is offered an option to open
a second program to handle some tasks. In any case the first program
should be terminated.
Is it possible to do this ?
Easily.
Post by Stark
1-The first program is possibly a windowless programm. Only if
conditions are met a window is needed. How do I do this?
Do not create a window. Write your code in the project file.
Post by Stark
2-The second program may be launched by the first. Does this mean that
the first is kept opne until the second is closed?
No. The two can run independently[0], and the first may terminate in
short order without any effect on the second whatsoever.
Post by Stark
Or there is a way to terminate
the first program before starting execution of the second ?
No. If the first program doesn't run, it _can't do anything_. This
might have been obvious.

Is there any reason in particular why this can't be a single program,
which does things both before and after it opens its first window?

Groetjes,
Maarten Wiltink

[0] A phenomenon known as 'multitasking'. You may have heard of it.
It's actually quite popular.
Stark
2010-10-08 12:58:26 UTC
Permalink
Post by Maarten Wiltink
Post by Stark
At Windows start, checks if conditions are met for some alarm to be
issued. If conditions are not met, the program is terminated (and the
user will not see it). Otherwise, the user is offered an option to open
a second program to handle some tasks. In any case the first program
should be terminated.
Is it possible to do this ?
Easily.
Post by Stark
1-The first program is possibly a windowless programm. Only if
conditions are met a window is needed. How do I do this?
Do not create a window. Write your code in the project file.
Post by Stark
2-The second program may be launched by the first. Does this mean that
the first is kept opne until the second is closed?
No. The two can run independently[0], and the first may terminate in
short order without any effect on the second whatsoever.
Post by Stark
Or there is a way to terminate
the first program before starting execution of the second ?
No. If the first program doesn't run, it _can't do anything_. This
might have been obvious.
Is there any reason in particular why this can't be a single program,
which does things both before and after it opens its first window?
Groetjes,
Maarten Wiltink
[0] A phenomenon known as 'multitasking'. You may have heard of it.
It's actually quite popular.
If I can check conditions i the project file, I don't need a separate
program. But the normal structure of a .dpr is:
Program MyProg;
uses
.... tutti i pas
begin
....
end.

How can I use the Delphi functions and other units functions without a uses,
interface and implementatio section ? Can you tell me waht the structure
should be ?

As far as multitawsking is concerned, I know what this is, but possibly I
did not explain myself. Immagine the following:
Program1
........ starts execution of Program1
......... if conditions are met, call Program2. Program1 is not needed
anymore
if ExecuteProgram2 then
Program2; // close Program1 and execute Program2 ??? Or Program1
resume execution after Program2 terminates ?
........
end.
Maarten Wiltink
2010-10-08 15:40:27 UTC
Permalink
Post by Stark
If I can check conditions i the project file, I don't need a separate
Program MyProg;
uses
.... tutti i pas
begin
....
end.
How can I use the Delphi functions and other units functions without
a uses, interface and implementatio section ? Can you tell me waht
the structure should be ?
Units, the uses clause, and interface and implementation sections are
a Borland addition to Pascal. Classically, a Pascal program starts with
the 'program' keyword and is a single monolithic source file.

Just add your required units to the uses clause. Treat the entire file
as the implementation section. Ignore the absence of the interface
section.
Post by Stark
As far as multitawsking is concerned, I know what this is, but possibly
Program1
........ starts execution of Program1
......... if conditions are met, call Program2.
Program1 is not needed anymore
if ExecuteProgram2 then
Program2; // close Program1 and execute Program2 ???
Or Program1 resume execution after Program2 terminates ?
........
end.
Just do nothing special, and pay close attention to what happens when
Program1 reaches the 'end.'

Groetjes,
Maarten Wiltink
Mikey
2010-10-11 15:49:56 UTC
Permalink
At Windows start, checks if conditions are met for some alarm to be issued. If
conditions are not met, the program is terminated (and the user will not see it).
Otherwise, the user is offered an option to open a second program to handle some
tasks. In any case the first program should be terminated.
1-The first program is possibly a windowless programm. Only if conditions are met a
window is needed. How do I do this?
2-The second program may be launched by the first. Does this mean that the first is
kept opne until the second is closed? Or there is a way to terminate the first
program before starting execution of the second ?
Why have two programs? If the alarm condition exists, enable the option(s) to do
whatever is needed, else just terminate. Waaaaaaaay simpler.

Mike

Loading...