Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Starting Other Applications

Posted on 1997-07-14
4
Medium Priority
?
145 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 60 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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 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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

688 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