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 Rhinorhino 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
Joined
Dec 21, 2001
Messages
3
Location
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);
 
Is'nt there a nother way then using direct ???
 
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
 
Thanks, this was just was I was looking for!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top