Solved

Getting Residing Directory

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now