Solved

Execute programs

Posted on 2000-04-11
6
250 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 13

Expert Comment

by:Epsylon
Comment Utility
Epsylon changed the proposed answer to a comment
0
 
LVL 13

Expert Comment

by:Epsylon
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now