Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Running app.

Posted on 2001-07-29
4
Medium Priority
?
148 Views
Last Modified: 2010-04-06
How do you run another app. that is within your current app. exe folder and error check if it is?
Or how do you runn it if it is in a folder within your current app.exe folder?
0
Comment
Question by:Enej
[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
  • 3
4 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6330880
Hello

  use shellapi to run the application, it will use the folder u r running ur program from as current folder and check about the file using FileExists

I hope that what are you looking for

Uses shellapi;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if FileExists('test.exe') then
    ShellExecute(handle,'open','test.exe',nil,nil,SW_ShowNormal)
  else
    ShowMessage('This file is not exist in the current folder');
end;

Mohammed
0
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 200 total points
ID: 6330889
Hello

  for better coding, use ExtractFilePath funcation tp get the folder for ur application that running.

uses shellapi;

procedure TForm1.Button1Click(Sender: TObject);
var
  Path : String;
begin
  Path := ExtractFilePath(Application.ExeName);
  if FileExists(Path + 'test.exe') then
    ShellExecute(handle,'open',Pchar(Path + 'test.exe'),nil,nil,SW_ShowNormal)
  else
    ShowMessage('This file is not exist in the current folder');
end;

if you want to run a program within ur current folder just add this folder to the path string like :

  Path := ExtractFilePath(Application.ExeName) + 'test folder\';

Best regards
Mohammed Nasman


0
 

Author Comment

by:Enej
ID: 6330964
SellamAlleikum Mohammed,
It works OK .Thanks!
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 6331080
wa alikum alsalam
I'm happy that's work with you :)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

609 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