Solved

Getting Residing Directory

Posted on 1998-11-19
2
243 Views
Last Modified: 2013-11-20
Hi

I have written a MFC application (*.exe) whereby my program need to know which directory does it is residing at.....

Formerly, I have used GetCurrentDirectory() and it work well a while until I have invoke this application from another directory (e.g. setting the PATH environment)....

So any one pls tell me how to find out where my program (*.exe) reside in??? Pls show a simple example... thanks....

0
Comment
Question by:ymw3
2 Comments
 
LVL 2

Accepted Solution

by:
cyrilbdt earned 50 total points
ID: 1324962
see GetModuleFileName.

char buf[_MAX_PATH];
GetModuleFileName(NULL, buf, sizeof(buf));

hope this helps
0
 

Author Comment

by:ymw3
ID: 1324963
Thanks.... It's work!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MFC Dialog 9 49
countEvens challenge 2 101
fizzArray2 challenge 1 79
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 574
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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