I need some help with my C++ program. I've got these custom-made PlaySound(char[MAX_PATH]) and PlayMusic(char[MAX_PATH], bool) functions that use the BASS sound engine. When I call an instance of OPENFILENAME (found in the samples), the sound (.wav and .mp3) plays perfectly.

My problem is that once the sound declared from OPENFILENAME starts playing, all other sounds returned an error stating that the program could not find the file specified. I tried clearing everything to do with the sound engine but got nowhere.

I found that I needed to specify the entire path of the sound file in order to get it to work. This is upsetting in the way that the sound files needs to be in a very specific folder. The same path that worked before I called an instance of OPENFILENAME was not found anymore.

I decided that the default folder was changed (maybe from the program's default folder to My Computer). So I need a way to reset the default folder in C++.

OPENFILENAME returns the entire path, by the way.

6 Years
Discussion Span
Last Post by Weird Nerd

Set the OFN_NOCHANGEDIR to the Flags item in the OPENFILENAME structure and it will not change the program's current working directory.

Edited by Ancient Dragon: n/a


Gee, thanks a ton, man.

Gosh, I haven't been doing my research... *blush*

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.