469,632 Members | 1,771 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,632 developers. It's quick & easy.

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

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
Nov 17 '05 #1
2 1699
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

"Serdge Kooleman" <Su***@web.de> wrote in message
news:eu**************@TK2MSFTNGP12.phx.gbl...
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

Nov 17 '05 #2
Serdge Kooleman <Su***@web.de> wrote:
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"


See http://www.pobox.com/~skeet/csharp/s....html#debugger

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Sathyaish | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.