Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using an exising *.exe file in my project

Posted on 1998-10-28
19
Medium Priority
?
135 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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.

 
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

670 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