Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Using an exising *.exe file in my project

Posted on 1998-10-28
19
Medium Priority
?
137 Views
Last Modified: 2012-05-04
How to use arj.exe in the project. Or how to use MS Dos prompt in project.

In general How to use dos executables in delphi projects
0
Comment
Question by:K_David
  • 8
  • 6
  • 4
  • +1
19 Comments
 

Author Comment

by:K_David
ID: 1344833
Thanx for yours answers
0
 
LVL 3

Expert Comment

by:bryan7
ID: 1344834
try this: ( drop a button in the form )

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ShellApi, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(0,'open','arj.exe','a ArjFile.arj','c:\',SW_SHOWNORMAL);
end;

end.

0
 
LVL 3

Expert Comment

by:bryan7
ID: 1344835
How to use it in a program:

include     SHELLAPI       in the USES clause;
then:

ShellApi(Handle,operation,File name,parameters,directory to work in,show mode);

Handle: I don't know, but with 0 it works
operation: OPEN and PRINT
    use OPEN to execute a program and PRINT to print a file, such as Readme.Txt
Parameters: paramaters..
Direc.. : the location where the program is
Show Mode: there are some ( Look at Delphi Help )
 ( no make the Ms-Dos box not visible, use SW_HIDE )


hope it helps.

bryan =)

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:viktornet
ID: 1344836
You could also use CreateProcess() which is easier when working with MS-DOS... Also you could use WinExec() which is not the best choice

Cheers,
Viktor
0
 
LVL 3

Expert Comment

by:bryan7
ID: 1344837
??
CreateProcess ???
WinExec ???

How do I use them ?

bryan

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1344838
Read some Delphi help.... If you can't figure it out by yourself, I'll write some examples for you..

Cheers,
Viktor
0
 

Author Comment

by:K_David
ID: 1344839
Thank you Bryan7 - i've allready figuret out by myself.
Here a piece of advise for u:
for hwhandle - u set it to 0 - instead u should use following:SW_SHOWNORMAL

thanx
0
 

Accepted Solution

by:
smartass earned 20 total points
ID: 1344840
to use DOS execute files in project:
include a batch file and simply type the file name in the Batchfile editor
then you you put this line under a tbutton
ShellExecute(0,'open',my.bat','nil','c:\',SW_SHOWNORMAL);
dont forget to add the SHELLAPI in the USES claus
0
 
LVL 3

Expert Comment

by:bryan7
ID: 1344841
smartass: did u read all the comments ?

k_david: ??? SW_SHOWNORMAL is not the hwhandle..

bryan

0
 

Author Comment

by:K_David
ID: 1344842
i'd like more Bryan7 answer!!
0
 
LVL 3

Expert Comment

by:bryan7
ID: 1344843
?? if you liked more my answer... why did you accept smartass answer ?

bryan

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1344844
bryan deserved the points.
0
 
LVL 3

Expert Comment

by:bryan7
ID: 1344845
well, I don't care about the points.
it's only that I don't understand why he/she choosed the other one.

bryan

ps: viktor: what's the hwHandle for ? I mean, the place where i put 0

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1344846
It's for the handle.... When you use ShellExecute() the hwHandle is usually set to 0...

Cheers,
Viktor
0
 
LVL 3

Expert Comment

by:bryan7
ID: 1344847
but, what can I use it for ?

bryan

0
 

Author Comment

by:K_David
ID: 1344848
To bryan7: I'm new to this kind of html quesioning...
so i'm sorry  - i really mean it, when i rejected an answer - i had allredy figure it out; but here u hafta accept one answer (i shoul accept yours - ) but i didn't know that back then

I'll avt more reasonable in  the future (if this had any meaning...)

About handle - the first handle (i put value SW_SHOWNORMAL). I think it controlls your Main Form - window from where are u calling dos exe programm.

Sorry about the points Bryan7 (Give other a chance)

Bye - K.David

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1344849
K.David...

You don't use SW_NORMAL to control the main form and all that crap... SW_NORMAL is not a handle it's simply a windows defined constant that is used when showing windows.... e.g.

ShowWindow(TheHandle, SW_NORMAL);

SW_NORMAL is the same as SW_SHOWNORMAL

Cheers,
Viktor
0
 
LVL 3

Expert Comment

by:bryan7
ID: 1344850
K.David: don't worry about the points. My goal here is to get and give help.
( though I get more than I give.. =)   )

Glad to help you and hope to get some advice from you too, I'm also new at delphi.

bryan =)

viktor: what can I use the hwhandle for ?

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1344851
Already told you... Take a look at the Win32.hlp file and see the paraemeters... You just set it to 0 and everything would be fine... 0 is the handle of the Desktop usually..

Cheers,
Viktor
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This is an update to some code that someone else posted on Experts Exchange. It is an alternate approach, I think a little easier to use, & makes sure that things like the Task Bar will update.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

580 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