Discussion:
Execute Dos Command from delphi win32 application.
(too old to reply)
Bijal
2006-11-23 08:40:23 UTC
Permalink
Raw Message
Hi,

I am very newbie to this Delphi world, specially i don't have much
knowledge about working with Windows API in Delphi Application.

I want to automate .bpl installer process from my application.

In Delpi win32 application, i am refering certain package (say
Pkg1).While running this delphi application, user has access to
chage/modify in package.So tht from application itself i want to
genrate modified .bpl file of tht package Pkg1 and also replace the
older with this new.All this shud happen from application.

So, for this i tried Dos Command uses dcc32.exe
C:\.....path\Pkg1\Pkg1.dpr -B.
Executing this command from cmd prompt externally, works well,replaces
older .bpl and .dcp file too.
Now to operate this dos command from application, I tried
CreateProcess( all params .....),
WaitForSingleObject
gives me Fatal error 'rtl' not found.

Somewhere read about use of batch or .cfg file may work.
But i don't know where and how to create and incorporate such files in
an application.
same error appears in outside cmd prompt also, if i m in running
mode.AS i closes application, file gets reload, but CreateProcess( )
doesn't creates/replaces older .bpl.

Also i thought to write one console application tht executes Dos
Command, and execute this appliation from (Delphi Win32 VCL ) my
application.

I am very sorry, but i m not able to do this.

Kindly give ur valuable time to solve my query.

Thnaks.
Looking forward for quick response.

With Regards,
Bijal...
sean
2006-12-29 11:23:05 UTC
Permalink
Raw Message
Post by Bijal
So, for this i tried Dos Command uses dcc32.exe
C:\.....path\Pkg1\Pkg1.dpr -B.
Executing this command from cmd prompt externally, works well,replaces
older .bpl and .dcp file too.
Now to operate this dos command from application, I tried
CreateProcess( all params .....),
WaitForSingleObject
Add the unit 'shellapi' to your uses clause - like this:

uses ShellAPI;

Once you've done that, you can use the ShellExecute function as
follows:

ShellExecute(Handle, 'open', 'dcc32.exe', 'C:\.....path\Pkg1\Pkg1.dpr
-B', 0);

However, this function execute asynchronously - which means your
application will carry on running in it's own thread once this other
application has started.

To see an article on shellexecute - Go here:
http://www.latiumsoftware.com/en/delphi/00002.php
To see an article about non-asynchronous tasks, where you need to wait
for the task to finish, Go here:
http://www.latiumsoftware.com/en/delphi/00003.php

Though it sounds like your error is because your delphi installation is
missing the run time library 'rtl' - I'd recommend you reinstall it.

Regards

Sean Johnstone

Loading...