Solved

Starting Other Applications

Posted on 1997-07-14
4
144 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month5 days, 6 hours left to enroll

636 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