Board index » delphi » How can I start one application from within (and only from within) a different one ?

How can I start one application from within (and only from within) a different one ?

Hello All,

I recall something similar to this was asked on this group a couple of
weeks ago but I have been unable to find it. So I'm sorry if this is the
same question -

I am writing an application (master.exe) from which I want to be able to
start another application (second.exe).

How can I -

1. Start 'second.exe' from within 'master.exe' ?

2. What can I do with 'second.exe' to make sure that it can only be
started from within 'master.exe', so that if a user were to try to run
'second.exe' on its own it would not work?

I know how to use shellexecute to start an application when one of its
files is opened, but not how to start the actual program itself.

Any help or advice would be greatly appreciated.

Thanks,

Liam Healy

 

Re:How can I start one application from within (and only from within) a different one ?


You can use the api call CreateProcess and pass a command line that you
test in the loaded app. This can be a simple command line that you don't
publish or something that can be checked back to a temporary file or
memory file created just before launch.
Personally I downloaded a free component called appexec that I use for
launching programs. Can't remember where from though possibly Delphi
Super Page but if you want it e-mail me and I'll send it.  
Nick Gabb
Quote
L. Healy wrote:

> Hello All,

> I recall something similar to this was asked on this group a couple of
> weeks ago but I have been unable to find it. So I'm sorry if this is the
> same question -

> I am writing an application (master.exe) from which I want to be able to
> start another application (second.exe).

> How can I -

> 1. Start 'second.exe' from within 'master.exe' ?

> 2. What can I do with 'second.exe' to make sure that it can only be
> started from within 'master.exe', so that if a user were to try to run
> 'second.exe' on its own it would not work?

> I know how to use shellexecute to start an application when one of its
> files is opened, but not how to start the actual program itself.

> Any help or advice would be greatly appreciated.

> Thanks,

> Liam Healy

Re:How can I start one application from within (and only from within) a different one ?


Quote
L. Healy wrote in message ...

>2. What can I do with 'second.exe' to make sure that it can only be
>started from within 'master.exe', so that if a user were to try to run
>'second.exe' on its own it would not work?

What about renaming the file to a .EXE from say a .DAT just before
executing it.  This would ensure it could not be executed "externally"
(without renaming it of course).

Re:How can I start one application from within (and only from within) a different one ?


Quote
"L. Healy" wrote:

> 2. What can I do with 'second.exe' to make sure that it can only be
> started from within 'master.exe', so that if a user were to try to run
> 'second.exe' on its own it would not work?

A simple down and dirty trick is to pass a command line parameter. Have
second.exe check the command line parameters passed to it looking for
some strange value "&&^$#$#$". You get the idea. If second.exe doesn't
see this value it just gives the user a message stating that they can
not run this application it must be used with master.exe.

Then when you call the application from master.exe be sure to pass it
the obscure command line value.

--
==== Programming my first best destiny! ====

Michael A. Hess      Miracle Concepts, Inc.
mh...@miraclec.com   http://www.miraclec.com

Re:How can I start one application from within (and only from within) a different one ?


Thanks Nick, Lester and Michael,

I have found the create process section in help, but there are a lot of
parameters and I can't see how to tell second.exe what to look for.

You couldn't give me a line or two of code to start me off could you?

I'm not lazy, I'm just not a professional programmer and my training in
Delphi stopped at NVQ level 1. Everything else I'm having to learn by
reading or from this group (which is actually better that the training I
received).

Thanks if you can, thanks if you can't.

Liam Healy

Re:How can I start one application from within (and only from within) a different one ?


On Sun, 12 Mar 2000 18:07:11 +0000, "L. Healy"

Quote
<L.He...@psychometrics.co.uk> wrote:
>Hello All,

>I recall something similar to this was asked on this group a couple of
>weeks ago but I have been unable to find it. So I'm sorry if this is the
>same question -

>I am writing an application (master.exe) from which I want to be able to
>start another application (second.exe).

>How can I -

>1. Start 'second.exe' from within 'master.exe' ?

>2. What can I do with 'second.exe' to make sure that it can only be
>started from within 'master.exe', so that if a user were to try to run
>'second.exe' on its own it would not work?

>I know how to use shellexecute to start an application when one of its
>files is opened, but not how to start the actual program itself.

>Any help or advice would be greatly appreciated.

How about passing a paramater to the program you want to run, and have
it run only if it gets the right paramater passed to it, and for the
paramater you could use a string of random characters.

TTFN
Arclight

Web Site:
wkweb5.cableinet.co.uk/daniel.davies/

Other Threads