Solved

Execute programs

Posted on 2000-04-11
6
252 Views
Last Modified: 2010-04-04
how to execute programs(like notepad, wordpad, paint...)?
0
Comment
Question by:Jurica2505
  • 5
6 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 2705425
Try this:

ShellExecute(Handle, 'open', 'notepad', '', '', SW_NORMAL);

ShellExecute(Handle, 'open', 'somefile.txt', '', '', SW_NORMAL);

ShellExecute(Handle, 'open', 'somefile.doc', '', '', SW_NORMAL);


Regards,

Epsylon.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2705456
Forgot to tell to put ShellAPI in the uses clause.

And here's another example:

ShellExecute(Handle, 'open', 'wordpad', 'c:\autoexec.bat', '', SW_NORMAL);


Cheers,

Epsylon.
0
 
LVL 2

Expert Comment

by:saar071697
ID: 2707373
you can try this the other way:

WinExec('notepad.exe',2);

You can replace the 2 at 1 or 0:
0 mean invisible
1 mean minimize
2 mean maximize
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 13

Expert Comment

by:Epsylon
ID: 2885145
Epsylon changed the proposed answer to a comment
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2885146
Uses ShellAPI;

ShellExecute(Handle, 'open', 'notepad', '', '', SW_NORMAL);

ShellExecute(Handle, 'open', 'somefile.txt', '', '', SW_NORMAL);

ShellExecute(Handle, 'open', 'somefile.doc', '', '', SW_NORMAL);

ShellExecute(Handle, 'open', 'wordpad', '', '', SW_NORMAL);

ShellExecute(Handle, 'open', 'paint', '', '', SW_NORMAL);
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 15 total points
ID: 2885147
Uses ShellAPI;

ShellExecute(Handle, 'open', 'notepad', '', '', SW_NORMAL);

ShellExecute(Handle, 'open', 'somefile.txt', '', '', SW_NORMAL);

ShellExecute(Handle, 'open', 'somefile.doc', '', '', SW_NORMAL);

ShellExecute(Handle, 'open', 'wordpad', '', '', SW_NORMAL);

ShellExecute(Handle, 'open', 'paint', '', '', SW_NORMAL);
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Send message from delphi to whatsapp, is it possible? 3 1,667
Delphi XE10 Round Image 2 155
Firemonkey android show image from resource ? 1 46
Delphi and Access based Enumeration 9 70
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

860 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