path to sound file. how to remove "@" from file path? need "\\" instead.

  • Thread starter Serdge Kooleman
  • Start date
S

Serdge Kooleman

hi

i'm trying to play sounds in my windows app.
wav files are in the same folder as .exe

if i'm getting path by command:
ApplicationPath = Application.StartupPath;

and it is look like

@"C:\Documents and Settings\Sergiy\My Documents\Visual Studio
Projects\SE\bin\Debug\SoundWrong.wav"

so my sounds not playing!

when i manually typed path: "C:\\Doc\\mysound.wav" it is started to work.

how to convert path with @ to the string with double \\?

to play sound i use function:

[DllImport("winmm.dll")]

private static extern bool PlaySound( string lpszName, int hModule, int
dwFlags );





thank you
 
P

Pete Davis

The @ is not actually part of the string. It's simply an indicator that "\"
shouldn't be treated as an escape character.

I suspect the real problem your string isn't being built correctly.

For example, the strings:

"C:\\Doc\\mysound.wav"
and
@"C:\Doc\mysound.wav"

are exactly the same thing.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top