Click here to Skip to main content
15,921,716 members
Home / Discussions / C#
   

C#

 
AnswerRe: Specified Cast is not Valid Pin
microsoc12-Jul-06 18:02
microsoc12-Jul-06 18:02 
QuestionWork Week Ranges Pin
TAREQ F ABUZUHRI12-Jul-06 6:39
TAREQ F ABUZUHRI12-Jul-06 6:39 
AnswerRe: Work Week Ranges Pin
Dustin Metzgar12-Jul-06 6:44
Dustin Metzgar12-Jul-06 6:44 
AnswerRe: Work Week Ranges Pin
Ennis Ray Lynch, Jr.12-Jul-06 6:53
Ennis Ray Lynch, Jr.12-Jul-06 6:53 
Questionpassing value from datagrid Pin
la vie12-Jul-06 6:21
la vie12-Jul-06 6:21 
Questionhow to generate a beep sound Pin
donkaiser12-Jul-06 6:20
donkaiser12-Jul-06 6:20 
AnswerRe: how to generate a beep sound Pin
Ennis Ray Lynch, Jr.12-Jul-06 6:57
Ennis Ray Lynch, Jr.12-Jul-06 6:57 
GeneralRe: how to generate a beep sound Pin
donkaiser12-Jul-06 8:38
donkaiser12-Jul-06 8:38 
I think I kinda get it how the process work to play a sound. I got this codes from VS2005 help. but when i passed my stream as a parameter a the button level, it doesn't find it. how do i get the right directory of the sounds sample?

public class Sound
{
[DllImport("CoreDll.DLL", EntryPoint = "PlaySound", SetLastError = true)]
private extern static int WCE_PlaySoundBytes(byte[] szSound, IntPtr hMod, int flags);
private byte[] m_soundBytes;
private enum Flags
{
SND_SYNC = 0x0000, /* play synchronously (default) */
SND_ASYNC = 0x0001, /* play asynchronously */
SND_NODEFAULT = 0x0002, /* silence (!default) if sound not found */
SND_MEMORY = 0x0004, /* pszSound points to a memory file */
SND_LOOP = 0x0008, /* loop the sound until next sndPlaySound */
SND_NOSTOP = 0x0010, /* don't stop any currently playing sound */
SND_NOWAIT = 0x00002000, /* don't wait if the driver is busy */
SND_ALIAS = 0x00010000, /* name is a registry alias */
SND_ALIAS_ID = 0x00110000, /* alias is a predefined ID */
SND_FILENAME = 0x00020000, /* name is file name */
SND_RESOURCE = 0x00040004 /* name is resource name or atom */

}
public Sound(Stream stream)
{
//read the data from the stream
m_soundBytes = new byte[stream.Length];
stream.Read(m_soundBytes, 0, (int)stream.Length);
}

public void Play()
{
WCE_PlaySoundBytes(m_soundBytes, IntPtr.Zero, (int)(Flags.SND_ASYNC | Flags.SND_MEMORY));
}

}

private void btnEmbedded_Click(object sender, System.EventArgs e) {
Sound sound = new Sound (Assembly.GetExecutingAssembly().GetManifestResourceStream("SoundSample.chimes.wav")); // null exception error
sound.Play();
}


Donkaiser
GeneralRe: how to generate a beep sound Pin
Ennis Ray Lynch, Jr.12-Jul-06 8:58
Ennis Ray Lynch, Jr.12-Jul-06 8:58 
AnswerRe: how to generate a beep sound Pin
engsrini12-Jul-06 8:06
engsrini12-Jul-06 8:06 
GeneralRe: how to generate a beep sound Pin
donkaiser12-Jul-06 8:56
donkaiser12-Jul-06 8:56 
QuestionHow can I disable a listBox item? Pin
AngryC12-Jul-06 6:12
AngryC12-Jul-06 6:12 
AnswerRe: How can I disable a listBox item? Pin
Not Active12-Jul-06 6:55
mentorNot Active12-Jul-06 6:55 
QuestionRead DiComm Headers Pin
jrandomuser12-Jul-06 5:56
jrandomuser12-Jul-06 5:56 
QuestionTooltip for a TrackBar control Pin
Jon Hulatt12-Jul-06 5:53
Jon Hulatt12-Jul-06 5:53 
AnswerRe: Tooltip for a TrackBar control Pin
alexey N12-Jul-06 21:22
alexey N12-Jul-06 21:22 
QuestionInstaller Project, Registry and Regasm Pin
Ranjan Banerji12-Jul-06 5:46
Ranjan Banerji12-Jul-06 5:46 
AnswerRe: Installer Project, Registry and Regasm Pin
Ranjan Banerji11-Sep-06 17:21
Ranjan Banerji11-Sep-06 17:21 
QuestionComboBox lock/suppress DropDown Pin
--Ian12-Jul-06 5:26
--Ian12-Jul-06 5:26 
AnswerRe: ComboBox lock/suppress DropDown Pin
Not Active12-Jul-06 5:33
mentorNot Active12-Jul-06 5:33 
GeneralRe: ComboBox lock/suppress DropDown Pin
--Ian12-Jul-06 6:38
--Ian12-Jul-06 6:38 
GeneralRe: ComboBox lock/suppress DropDown Pin
Not Active12-Jul-06 6:46
mentorNot Active12-Jul-06 6:46 
GeneralRe: ComboBox lock/suppress DropDown Pin
--Ian12-Jul-06 7:13
--Ian12-Jul-06 7:13 
GeneralRe: ComboBox lock/suppress DropDown Pin
VB 8.05-Feb-09 1:01
VB 8.05-Feb-09 1:01 
QuestionComboBox Custom OnPaint Pin
--Ian12-Jul-06 5:15
--Ian12-Jul-06 5:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.