Important alert: (current site time 7/16/2013 5:08:01 AM EDT)
 

article

a more usable ShellExecute

Email
Submitted on: 1/1/2003 2:28:10 PM
By: Erik Ellis 
Level: Beginner
User Rating: By 7 Users
Compatibility: Delphi 7, Delphi 6, Delphi 5
Views: 23023
author picture
(About the author)
 
     I´we sen alot of ShellExecute tutorials but thay arent that good, there is stuff thats missing.

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
  1. You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
				This is my first tutorial so dont get upset if its no good, just post a coment and ill fix it.

ShellExecute(0,'open',PChar(prog),pchar(params),'',SW_SHOWNORMAL);

1 (ShellExecute) Thats a ShellAPI command and therefore you need to add ShellAPI to Uses

2 (The first "PChar" command) Betven the brakets you add Dir+FileName like so : c:\dir\file.exe

3 (The second "PChar" command) Add parameters to it like hl.exe´s : -console -game ns

Now thats more stable and is compateble with stuff like : edit1.text + '\hl.exe'

Im uploading my updated verson of Jason´s apis.pas with stuff like RunApp, OpenBrowser and FileName.exe to FileName Converter


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

1/14/2003 5:44:34 PMRaX

hm. This is the very basic side of shellapi. And the explaination is quite vague, but I wont poke at it. But an explanation of the different options, such as param #2: Open, Print etc and SW_SHOWNORMAL and be interpreted to SW_SHOW, or even SW_HIDE so the executed app will not be shown.
(If this comment was disrespectful, please report it.)

 
5/3/2003 2:20:42 PM

It didnt work when i used it. it said nothing in line was rite
(If this comment was disrespectful, please report it.)

 
7/16/2003 6:56:35 PM

You forgot to mention that "uses ShellAPI" is required.
(If this comment was disrespectful, please report it.)

 
3/2/2004 9:42:55 AMt0rus

the author did mention that uses ShellAPI is required, if you read the tutorial carefully first, and start bashing later, you might find that it works fine i tried
ShellExecute(0,'open','ftp','somehost.com','',SW_SHOWNORMAL);
and it worked perfectly

the explanation could be elaborated, yes, but those who seek, will find what they need
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.