Solved

Starting Other Applications

Posted on 1997-07-14
4
143 Views
Last Modified: 2010-04-06
I can't beleive this is so complicated in Delphi.  I simply want to start another application, not necesarily for OLE or DDE puposes.  In Paradox, I simply put 'Execute.notepad.exe' in a button - and it happened.  I tried CreateProcess and WinExec and neither work.  Can someone write so CODE telling me how to execute an .exe file.  

I'll assume your code will search the existing directory for the .exe, then the PATH, then the entire drive.  If this is not the case, please let me know what the code is to do this.
0
Comment
Question by:d4jaj1
[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
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
erajoj earned 20 total points
ID: 1338831
It's not harder to do than this:
(You just have to tell the system how the application's
supposed to be shown)

WinExec('notepad.exe', SW_SHOWNORMAL);

...OR...

uses ShellAPI;
   .
   .
   .
ShellExecute(Handle, 'open', 'notepad.exe', '', '', SW_SHOWNORMAL);

/// John

0
 
LVL 3

Author Comment

by:d4jaj1
ID: 1338832
Thanks, it works great!  I'm going to rate you Excellent on this, but I wanted to make sure this would search teh current directory, then windows directory, or all drives on the user's system?  

The reason I'm asking is the user will be able to install some files where ever thhey want, thus my program would need to search for it.
0
 
LVL 3

Author Comment

by:d4jaj1
ID: 1338833
I'll assume either you didn't have time or didn't know teh answer to my clairification answer.
0
 
LVL 4

Expert Comment

by:erajoj
ID: 1338834
Sorry, I didn't realize that it was a question.
These methods scan directories like this (taken from the help file):

1.      The directory from which the application loaded.
2.      The current directory.
3.      The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
4.      The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
5.      The directories listed in the PATH environment variable.

If you need to scan any arbitrary directory, you have to scan
that yourself, preferrably with a recursive function using
"FindFirst/Next/Close". But if you do; ask a formal question
so that the experts here get some more points. :-)

/// John

0

Featured Post

Technology Partners: 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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

738 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