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

TOpenDialog changes directory?

Status
Not open for further replies.

ug505

Programmer
Jan 2, 2010
52
US
I have an image that uses an OnMouseMove event that changes the image to another one located in a folder. The image is located in a TImage folder I created. Also, I have a TMediaPlayer and a TOpenDialog.

Problem: Whenever the TOpenDialog is used to pick an audio file, TMediaPlayer opens the file like normal, but when I roll my mouse over the image that changes, it shows an error:

Cannot open file "E:\Music\TImage\GoButton.bmp", The system cannot find the path specified.

The normal default directory it should open the TImage folder in is "E:\Sky High Browser 2.0." It changes somehow. Can someone help me? I hope I explained well enough.
 
Yes TOpenDialog changes the current directory. If you're working with files from an implied path, like the same place your executable is, you need to find the path and use it in front of whatever file it is you want to open there. Depending on how you do it, GetCurDir, or ExpandFilePath(Paramstr(0)) will help you.

I'm waiting for the white paper entitled "Finding Employment in the Era of Occupational Irrelevancy
 
I don't really understand. Could you please help me with this to where it can still change the image and be able to load files in the dialog without it changing the directory.
 
TOpenDialog changes the current directory. That can't be changed. All you can do is work around it. You have been given instructions how.

I'm waiting for the white paper entitled "Finding Employment in the Era of Occupational Irrelevancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top