Solved

Execute programs

Posted on 2000-04-11
6
254 Views
Last Modified: 2010-04-04
how to execute programs(like notepad, wordpad, paint...)?
0
Comment
Question by:Jurica2505
[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
  • 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
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 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

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!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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 this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

729 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