Solved

Emdedding an app within Delphi application

Posted on 1998-07-09
7
146 Views
Last Modified: 2010-04-04
I will like to include an .exe application to be run within my D3 application.  Please help!
0
Comment
Question by:Ogunbo
7 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1357472
Hi Ogunbo,

 What do you exaclty want :

 Starting .exe from delphi program and receiving the error-codes? or ?...
 Zif.
0
 
LVL 5

Expert Comment

by:mayhew
ID: 1357473
If you want to run another .exe from your Delphi app you might be wanting to use the Win API call CreateProcess (for 32 bit apps - the 16 bit version was WinExec).

The description is in the Win32s.hlp file.

Be sure to include windows in your uses clause.  And you can see the Pascal function declaration in \source\rtl\win\windows.pas.  (My apologies if you already know this).
0
 

Accepted Solution

by:
kashif063098 earned 150 total points
ID: 1357474
Two  ways

1--using Winexec()
Example
fucntion AnyFunction:integer;
VAR
 appName:string;
 RESULT:integer
begin
 appName:=ApplcationPath; {C:\PKZIP.EXE}
 RESULT:=WinExec(appName,SW_SHOWNORMAL);
 IF RESULT > 31 THEN {if RESULT < 31 then there is some problem uses GetLastError                                     to find the reason}
 ShowMessage('Its ok,it should run the application' );

end;

2--Using CreateProcess() Win32 Api

function AnyFunction:integer;
begin
 CreateProcess(
                       {1}  PChar('C:\pkzip.exe'),  
                       {2}  PChar('c:\Pkzip.exe '+  'c:\z\z1.zip ' + FileToZip),
                       {3}  NIL,
                       {4}  NIL,
                       {5}  False,
                       {6}  0{CREATE_NEW_CONSOLE},
                       {7}  NIL,
                       {8}  PChar('C:\'),
                       {9}  lpStartupInfo,
                       {10} lpProcInformation) ;

end;

If you feel any difficulty in order to follow these examples ,let me know


bye


kashif
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Expert Comment

by:kashif063098
ID: 1357475
In second example use your application names and path.if CreateProcess() returns -1 uses GetLastError function to find out the reason of the failure
0
 
LVL 3

Expert Comment

by:vladika
ID: 1357476
Also you can use ShellExecute, ShellExecuteEx

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1357477
Still, we don't know exactly what Ogunbo wants.
0
 

Author Comment

by:Ogunbo
ID: 1357478
Thank you all folks.  I will appreciate a real example of what the source should look like.  I have a database application made in D3 and I used another program to create an exe file.  Actually, this exe.file is an expert system that uses the same table as my database.  Since I couldn't program an expert system in Delphi, I am wondering if I can use the already made expert system (.exe file) in my database application.  Such that a user of the database might click a button called "expsys" for the expert system to be run.  In a way it would look like I am using D3 as an interface for the expert system.  Well, this is my problem and will appreciate what my unit should look like.  Thank you.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now