473,699 Members | 2,838 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Sta rtupPath;

and it is look like

@"C:\Documen ts and Settings\Sergiy \My Documents\Visua l Studio
Projects\SE\bin \Debug\SoundWro ng.wav"

so my sounds not playing!

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

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

to play sound i use function:

[DllImport("winm m.dll")]

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

thank you
Nov 17 '05 #1
2 1865
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\\mysou nd.wav"
and
@"C:\Doc\mysoun d.wav"

are exactly the same thing.

Pete

"Serdge Kooleman" <Su***@web.de > wrote in message
news:eu******** ******@TK2MSFTN GP12.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.Sta rtupPath;

and it is look like

@"C:\Documen ts and Settings\Sergiy \My Documents\Visua l Studio
Projects\SE\bin \Debug\SoundWro ng.wav"

so my sounds not playing!

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

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

to play sound i use function:

[DllImport("winm m.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.Sta rtupPath;

and it is look like

@"C:\Documen ts and Settings\Sergiy \My Documents\Visua l Studio
Projects\SE\bin \Debug\SoundWro ng.wav"


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

--
Jon Skeet - <sk***@pobox.co m>
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2873
by: michaaal | last post by:
I have two folders in my website... Folder1 (this is where my #include file is, this is where the style.css is) --Folder2 (Folder2 is inside of Folder1) Folder2 contains a file that has this #include statement... <!--#include file="../include.inc"-->
2
4344
by: Sathyaish | last post by:
I am using MCI (winmm.dll) to read, record and playback sound. For now, I am doing this with disk files instead of realtime doing it straight from the memory. If I want to stream/relay/transmit this sound (file) on a Windows socket (not using FTP but TCP), can I read the file into a byte array? Because if it is possible then I can send it on the socket but the problems I foresee are: How will I repack it into the file. Will just reading...
2
5351
by: Murphy | last post by:
Our website contains subdirectories for each subsidiary company, each company has it's own look and feel to the pages in their subdirectory although they are all part of the main website. The code below in the Web.Config file defines the authentication as forms and the aspx file required for login if the user is unauthenticated... this works well for the root level company web pages however when a user viewing the website of SubCompanyA...
4
9790
by: Russell Warren | last post by:
I've been having a hard time tracking down a very intermittent problem where I get a "permission denied" error when trying to rename a file to something that has just been deleted (on win32). The code snippet that gets repeatedly called is here: ... if os.path.exists(oldPath): os.remove(oldPath) os.rename(newPath, oldPath)
3
4151
by: jason | last post by:
I've been playing around with new (for 2.0) membershp functionality. I was able to build a simple login form that secures a directory on a project I built locally on my development desktop. However, when I attempt to follow the same steps on the remote test server (a website I access via filesystem security accross my lan ).. I get the following when I attempt to select the security tab from the administer selection of the login...
2
3654
by: JDeats | last post by:
Using VS.NET 2005, if you place a WinForms WebBrowser control on a form, then place a command button on that form and in the "click" even handler for the command you do: webBrowser1.DocumentText = ""; On every mouse click you were hear a "click" sound identical to the sound Internet Explorer makes as it navigates from one site to the next. If you're getting creative with the webBrowser control this is quite annoying.
4
6907
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the function creates the file as expected. When I loop through my array I get the error - "ArgumentException was unhandled - Illegal characters in path" The value "C:\Temp.txt" is the first value in the array - as it works
26
3893
by: Jake Barnes | last post by:
I did a search on the newsgroup comp.lang.javascript. I was searching for "how to play a sound with Javascript". I'm somewhat suprised that the majority of entries are from the 1990s, and there are almost no posts from the last 3 years: http://groups.google.com/group/comp.lang.javascript/search?group=comp.lang.javascript&q=how+to+play+a+sound+with+Javascript&qt_g=Search+this+group Even after sorting by date, there don't appear any...
2
6002
by: CGatto | last post by:
Hi, We have just started getting the following error during compiles of our forms-based application. We are developing in VS2008, VB.Net, with Team Foundation Server-based source control. Full error message is: "Unable to copy file "obj\Debug\OurProjectName.xml" to "bin\Debug\OurProjectName.xml". Access to the path 'obj\Debug\OurProjectName.xml' is denied."
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.