dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: Beginner
Feb 1, 1999

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Executing external programs

Question:
I know that you can execute a program from a known drive using the system command, but what if you don't know the drive letter? I am trying to create a program that will be written on a CD. The Auto-run will execute this program. I want this program on the CD to have buttons to run exe's (setup files) on the CD with a single click. Therefore, since the drive changes from PC to PC, I need to know how to run off of the local drive (the one it runs off of now) like the system command. It would be helpful to know how to stop the MS-DOS window from appearing when you run the system command as well.

Answer:
Assuming this is for Windows, you can use something like GetModuleFileName to obtain the complete filename of the running program including path and drive. As far as the DOS window popping up, I've only noticed this for DOS programs and not for Windows programs but, if it is an issue for you, try using ShellExecute instead of system.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date