By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 909 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.