The running program directory can be obtained with GetProjectDir () function.
As per dynamic pathnames, you could set the current working directory with CurDir () function to the files directory, this should permit sndPlaySound to find your sounds.
The directory of the files could be stored in a configration file to update on every machine to the actual directory: the program could read the configuration file when starting and set the current working directory to the pathname stored in it.
But on winSDK is specified that sndPlaySound is present only for backward compatibility and that PalySound function should be used instead. PlaySound documentation refers to OpenFile function for details on directory searching order, and in that function it is stated:
"If the lpFileName parameter specifies a file name and extension only, this function searches for a matching file in the following directories, in the order shown:
1. The directory from which the application loaded.
2. The current directory.
3. Windows 95: The Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
Windows NT/2000: The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is SYSTEM32.
4. Windows NT/2000: The 16-bit Windows system directory. There is no Win32 function that obtains the path of this directory, but it is searched. The name of this directory is SYSTEM.
5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
6. The directories that are listed in the PATH environment variable. "That is: if you store the files in the executable's directory you should find them without any other specification.
Hope this helps
Roberto