Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help...Program Folder

Status
Not open for further replies.

AlienWar

Programmer
Dec 21, 2001
3
DK
Hi,

How can I get the folder were my program is placed???
Plz in clean SDK code, not MFC.
Please Help Me.
..:::Ali£nWar:::..
 
You can do it with the following code:

#include <direct.h>
.....
......
char Buffer[_MAX_PATH];// you can choose any other size that feet
_getcwd(Buffer,_MAX_PATH);
 
These should work fine:

#include<windows.h>
#include<iostream.h>
....
......
char Buffer[_MAX_PATH];// you can choose any other size that feet
HINSTANCE hInstance = GetModuleHandle(NULL);
GetModuleFileName(hInstance, Buffer, MAX_PATH);
cout<< &quot;This program is: &quot;<<Buffer<<endl; // you can also use a 'MessageBox' to display this
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top