Solved

Getting Residing Directory

Posted on 1998-11-19
2
244 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

840 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