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!

LoadFromFile from directory

Status
Not open for further replies.

jjschwartz

Technical User
Feb 3, 2004
23
0
0
US
I want to loadfromfile several images that will be in the directory that the final compiled application will be in. But I won't know in advance what directory the user might place the application.

Is there a way to have loadfromfile (and/or other directory-related functions) look in the application's directory? Is there a way to determine what directory the application is in?

TIA,
Jeffrey Schwartz
 
you can also try this :

Code:
YourApplicationPath:=ExtractFilePath(ParamStr(0));



--------------------------------------
What You See Is What You Get
 
You can also just not specify a path at all. All files will then be assumed to be in the same directory as the application. This also allows you to change this folder by modifying the shortcut used to run your program. Right-click the shortcut, choose Properties, and change the 'Start In' directory. (some OS's may call this 'Working Directory').
 
Yes there is a solution to your problem
procedure
var CurDir:String;
ImgName:String;
begin
// application dir is
CurDir:=ExtractFilepath(application.exename);
// loading... // i am not sure about the picture.cant open my delphi now but you know how it it
Image1.Picture.LoadFormFile(CurDir+'/images/'+ImgName);

// put this in Foror WHILE and there you go !
Good Luck If you still have problems ask

Spent
mail:spentbg@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top