Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using an exising *.exe file in my project

Posted on 1998-10-28
19
Medium Priority
?
136 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

886 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