954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Creating a delphi program to autoinstall other programs?

Hi

I am trying to create a delphi program to autoinstall other multiple utilities such as adobe reader, winamp etc. I am firstly wondering how to execute an external exe file. and also, is there a way to pass mouse clicks through delphi to this external program?

Thanks

Sean Bedford

sbedford
Newbie Poster
18 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

Hi,
I have an answer to 'how to execute an external exe file'.

Under 'implementation' and before your first procedure type in 'uses ShellAPI;'

After typing that in, add the following code to one of your procedures:

ShellExecute(Handle, 'open', 'type in the directory of your file e.g. c:\test.txt', nil, nil, SW_SHOWNORMAL);

Hope that helps

satrix36
Newbie Poster
20 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

Thanks, that did the job!

sbedford
Newbie Poster
18 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

This works fine, but how can I replace the string of the file to execute by my string.

I have:

Var
txt : string;
.
.
txt := 'myprogram.exe'
.
.
ShellExecute(Handle, 'open', txt, nil, nil, SW_SHOWNORMAL);

This gives a compile error:
Incompatible types: 'String' and 'PAnsiChar'

How can I conver my string to PAnsiChar?

AKJo
Junior Poster in Training
59 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

You can convert it like any other conversion with pansichar(txt) or, you could have made the variable an ansichar and sent the pointer..

LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
 

If just launch a new app then use ShellExecute, then you can hide them or hide your app to enable auto setup

------------------------------------

Self Cert best acne solution products

Jacob777
Newbie Poster
3 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

I would recommend you to creating SFX archive and add your executable myprogram.exe as run after extract item. In this way you need not to call shell execute for launching you application.If you want to know more about this then just let me know.
Thanks,
David

david Booch
Newbie Poster
1 post since Dec 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You