Click here to Skip to main content
16,015,177 members
Home / Discussions / C#
   

C#

 
AnswerRe: .Net version of depends? Pin
Dave Kreskowiak3-Mar-08 9:39
mveDave Kreskowiak3-Mar-08 9:39 
GeneralRe: .Net version of depends? Pin
Russell Jones3-Mar-08 22:49
Russell Jones3-Mar-08 22:49 
Generaldatabind myTextbox.Text to myXmlElement.Value Pin
buchstaben3-Mar-08 4:42
buchstaben3-Mar-08 4:42 
QuestionGetManifestResource problem Pin
JustRonald3-Mar-08 4:36
JustRonald3-Mar-08 4:36 
GeneralRe: GetManifestResource problem Pin
led mike3-Mar-08 5:02
led mike3-Mar-08 5:02 
GeneralRe: GetManifestResource problem [modified] Pin
DaveyM693-Mar-08 6:07
professionalDaveyM693-Mar-08 6:07 
GeneralRe: GetManifestResource problem Pin
Giorgi Dalakishvili3-Mar-08 6:20
mentorGiorgi Dalakishvili3-Mar-08 6:20 
GeneralRe: GetManifestResource problem Pin
DaveyM693-Mar-08 8:51
professionalDaveyM693-Mar-08 8:51 
I thought this was something interesting that I could maybe use so I've had a play and the example below works (ringin.wav from C:\Windows\Media added to resources and BuildAction property set to Embedded Resource).

using System;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Load += new EventHandler(Form1_Load);
        }

        void Form1_Load(object sender, EventArgs e)
        {
            Stream wave = Assembly.GetExecutingAssembly().
                GetManifestResourceStream(
                MethodBase.GetCurrentMethod().
                DeclaringType.Namespace + ".Resources." + "ringin.wav");
            Byte[] waveData = new Byte[wave.Length];
            wave.Read(waveData, 0, (int)wave.Length);
            PlaySound(waveData, IntPtr.Zero, SoundFlags.SND_ASYNC | SoundFlags.SND_MEMORY);
        }

        enum SoundFlags
        {
            SND_SYNC = 0x0000,
            SND_ASYNC = 0x0001,
            SND_MEMORY = 0x0004,
            SND_NODEFAULT = 0x0002,
            SND_LOOP = 0x0008,
            SND_NOSTOP = 0x0010,
            SND_NOWAIT = 0x00002000,
            SND_FILENAME = 0x00020000,
            SND_RESOURCE = 0x00040004
        }

        [DllImport("winmm.dll")]
        static extern bool PlaySound(byte[] pszSound, IntPtr hmod, SoundFlags fdwSound);
    }
}


I've used SoundFlags.SND_ASYNC as it's in the load event but if you want it in FormClosing for example use SoundFlags.SND_SYNC

Dave

GeneralRe: GetManifestResource problem Pin
ADLER13-Mar-08 11:24
ADLER13-Mar-08 11:24 
GeneralMonth and year control Pin
Yulianto.3-Mar-08 3:40
Yulianto.3-Mar-08 3:40 
GeneralRe: Month and year control Pin
Pete O'Hanlon3-Mar-08 3:46
mvePete O'Hanlon3-Mar-08 3:46 
GeneralRe: Month and year control Pin
Yulianto.3-Mar-08 3:49
Yulianto.3-Mar-08 3:49 
GeneralRe: Month and year control Pin
Pete O'Hanlon3-Mar-08 4:18
mvePete O'Hanlon3-Mar-08 4:18 
GeneralRe: Month and year control Pin
Yulianto.3-Mar-08 4:24
Yulianto.3-Mar-08 4:24 
GeneralRe: Month and year control Pin
Pete O'Hanlon3-Mar-08 5:04
mvePete O'Hanlon3-Mar-08 5:04 
GeneralRe: Month and year control Pin
PIEBALDconsult3-Mar-08 8:45
mvePIEBALDconsult3-Mar-08 8:45 
GeneralRetrieving text at a specific index from a text file Pin
jimmy2shoes3-Mar-08 3:21
jimmy2shoes3-Mar-08 3:21 
AnswerRe: Retrieving text at a specific index from a text file Pin
Eslam Afifi3-Mar-08 6:12
Eslam Afifi3-Mar-08 6:12 
Questionhow to add database fields dynamically to a crystal report in .net 2005 #1 Pin
Member 36683083-Mar-08 2:07
Member 36683083-Mar-08 2:07 
QuestionDatagridview, disable row selection Pin
alexander_perdum3-Mar-08 1:44
alexander_perdum3-Mar-08 1:44 
GeneralRe: Datagridview, disable row selection Pin
Xmen Real 3-Mar-08 4:51
professional Xmen Real 3-Mar-08 4:51 
GeneralRe: Datagridview, disable row selection Pin
alexander_perdum3-Mar-08 5:01
alexander_perdum3-Mar-08 5:01 
GeneralRe: Datagridview, disable row selection Pin
Xmen Real 3-Mar-08 5:12
professional Xmen Real 3-Mar-08 5:12 
GeneralRe: Datagridview, disable row selection Pin
alexander_perdum3-Mar-08 5:21
alexander_perdum3-Mar-08 5:21 
GeneralRe: Datagridview, disable row selection Pin
Xmen Real 3-Mar-08 5:26
professional Xmen Real 3-Mar-08 5:26 

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.