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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with relative path...

Status
Not open for further replies.

Hylsan

Programmer
Mar 20, 2002
43
0
0
SE
Hi!
I have a program that loads a activeX-component. the code looks like this;

m_ActiveX.loadfile("C:\\file.xxx");

The problem is that i want the "file.xxx" to be in a subfolder called "data", right under the folder where the "file.xxx" is. Ive tried writing just ("data\\file.xxx") and numerous other alternatives but non works.

Could someone please help me on this since i know it can be done, but ive forgotten how.

Many thanks in advance..
Hylsan
 
This obtains the entire file path name. Then you can parse it to get just the path and append the other file name to create your goal.
Code:
	LPTSTR lpfile[_MAX_PATH + 1];
	::GetModuleFileName( 0L, (LPTSTR)lpfile, _MAX_PATH);

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top