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.

Recommended Answers

All 2 Replies

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

Gee, thanks a ton, man.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.