Solved

running outside applications

Posted on 1998-12-14
8
123 Views
Last Modified: 2010-04-04
I'm trying to set up an auto-run program for a cd that I'm creating for a friend.  I'd like to be able to access outside applications, ie Windows Explorer off of buttons.  I'm not sure how to do this, seeing as how I haven't been programming in Delphi very long.
0
Comment
Question by:Franker
8 Comments
 
LVL 4

Expert Comment

by:dwwang
ID: 1350907
You can use WinExec('c:\...\ExeName',SW_SHOW);
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1350908
Or CreateProcess or ShellExecute or ShellExecuteEx...
0
 
LVL 3

Accepted Solution

by:
philipleighs earned 50 total points
ID: 1350909
This code will open windows explorer starting in Program Files. Change explore to open if you want views like the ones that appear when you double click My Computer on the desktop.

ShellExecute(Application.Handle,
                        PChar('explore'),
                        PChar('c:\program files'),
                        PChar(''),
                        PChar(''),
                        SW_SHOWDEFAULT);
0
Gigs: Get Your Project Delivered by an Expert

Select from 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.

 
LVL 3

Expert Comment

by:philipleighs
ID: 1350910
Don't forget to add ShellApi to your uses clause.

Cheers,
Phil.

0
 
LVL 4

Expert Comment

by:dwwang
ID: 1350911
???
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1350912
Hi dwwang,
What's up?
0
 

Author Comment

by:Franker
ID: 1350913
my other question with this is how can I detect where it's running from, for example I know in Java (the last language I was programming in) there's the command getDocumentBase() where you can retrieve the directory where the .java file is located.
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1350914
Do you mean that you want to extract 'c:\mydir\' from 'c:\mydir\javafile.java'?
If so, use ExtractFilePath and add SysUtils to the uses clause.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 100
When i run adoquery my application freezes 26 165
Delphi: making a BW image transparent 10 37
enhance the following code 3 30
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…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
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…

776 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