Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
QuestionDisplaying an owned form when main form is shown Pin
Luis Alonso Ramos4-Oct-05 5:11
Luis Alonso Ramos4-Oct-05 5:11 
AnswerSolved! Pin
Luis Alonso Ramos4-Oct-05 5:42
Luis Alonso Ramos4-Oct-05 5:42 
AnswerRe: Displaying an owned form when main form is shown Pin
mav.northwind4-Oct-05 7:07
mav.northwind4-Oct-05 7:07 
QuestionRemoting URI question ? Pin
Member 127995794-Oct-05 5:10
Member 127995794-Oct-05 5:10 
AnswerRe: Remoting URI question ? Pin
S. Senthil Kumar4-Oct-05 6:07
S. Senthil Kumar4-Oct-05 6:07 
QuestionAutocompletion Pin
PaulaM4-Oct-05 5:07
PaulaM4-Oct-05 5:07 
AnswerRe: Autocompletion Pin
Daniel Grunwald4-Oct-05 5:54
Daniel Grunwald4-Oct-05 5:54 
Questionwav file + c# Pin
g00fyman4-Oct-05 3:26
g00fyman4-Oct-05 3:26 
how do i play short wav file in c# then stop when it finishes.

i have a timer that will fire when a remote server goes offline, the timer_tick fires every 10000 millisec, and the wav file is 1.5 secs long.

when i use the code below and play synchronisly it just repeats continouslyand seems to stall the form, as i cant click the button to shut it up Frown | :(

if i play it asynchronously, then it plays over the top of itself repeatedly Frown | :(

how can i just play it one every 10 seconds until i cancel it ?

<br />
if(online)<br />
      {<br />
        this.stationStatus.Text = "ONLINE";<br />
        this.stationStatusPicture.Image = this.statusImages.Images[0];<br />
      }<br />
      else<br />
      {<br />
        this.recogniseAlertButton.Visible = true;<br />
<br />
        offlineTimer = new Timer();<br />
        offlineTimer.Interval = 10000;<br />
        offlineTimer.Tick += new EventHandler(offlineTimer_Tick);<br />
        offlineTimer.Start();<br />
      }  <br />
<br />
WSounds ws;<br />
    private void offlineTimer_Tick(object sender, EventArgs e)<br />
    {<br />
      ws = new WSounds();<br />
       <br />
      try<br />
      {<br />
        ws.Play("offline.wav", ws.SND_FILENAME/*|ws.SND_ASYNC*/);<br />
<br />
        this.stationStatus.Text = "OFFLINE";<br />
        this.stationStatusPicture.Image = this.statusImages.Images[1];<br />
      }<br />
      catch(IOException ioe)<br />
      {<br />
        Debug.WriteLine(ioe.Message);<br />
      }<br />
    }<br />
<br />
public class WSounds<br />
  {<br />
    [DllImport("WinMM.dll")]<br />
    public static extern bool  PlaySound(string fname, int Mod, int flag);<br />
<br />
    // these are the SoundFlags we are using more in mmsystem.h<br />
    public int SND_ASYNC    = 0x0001;     // play asynchronously<br />
    public int SND_FILENAME = 0x00020000; // use file name<br />
    public int SND_PURGE    = 0x0040;     // purge non-static events<br />
<br />
    public void Play(string fname, int SoundFlags)<br />
    {<br />
      PlaySound(fname, 0, SoundFlags);<br />
    }<br />
<br />
    public void StopPlay()<br />
    {<br />
      PlaySound(null, 0, SND_PURGE);<br />
    }<br />
  }<br />


kid regards,
g00fy
Questionhandling table SQL in 1 class? Pin
mpw_4-Oct-05 2:34
mpw_4-Oct-05 2:34 
AnswerRe: handling table SQL in 1 class? Pin
Wjousts4-Oct-05 3:26
Wjousts4-Oct-05 3:26 
GeneralRe: handling table SQL in 1 class? Pin
mpw_4-Oct-05 3:45
mpw_4-Oct-05 3:45 
AnswerRe: handling table SQL in 1 class? Pin
g00fyman4-Oct-05 3:31
g00fyman4-Oct-05 3:31 
GeneralRe: handling table SQL in 1 class? Pin
mpw_4-Oct-05 4:11
mpw_4-Oct-05 4:11 
QuestionForm Inheritance Pin
PHDENG814-Oct-05 2:08
PHDENG814-Oct-05 2:08 
AnswerRe: Form Inheritance Pin
spif20014-Oct-05 2:10
spif20014-Oct-05 2:10 
GeneralRe: Form Inheritance Pin
PHDENG814-Oct-05 2:21
PHDENG814-Oct-05 2:21 
GeneralRe: Form Inheritance Pin
PHDENG814-Oct-05 2:31
PHDENG814-Oct-05 2:31 
GeneralRe: Form Inheritance Pin
spif20014-Oct-05 2:32
spif20014-Oct-05 2:32 
Questionhi all Pin
magnifique4-Oct-05 1:44
magnifique4-Oct-05 1:44 
AnswerRe: hi all Pin
Guffa4-Oct-05 2:06
Guffa4-Oct-05 2:06 
QuestionDeriving a class variable from a string Pin
MrEyes4-Oct-05 1:39
MrEyes4-Oct-05 1:39 
AnswerRe: Deriving a class variable from a string Pin
Robert Rohde4-Oct-05 2:05
Robert Rohde4-Oct-05 2:05 
QuestionStandard Deviation Graph?? Pin
parvinder sehrawat4-Oct-05 1:34
parvinder sehrawat4-Oct-05 1:34 
QuestionHandling .class files in C# Pin
Dsypher4-Oct-05 1:07
Dsypher4-Oct-05 1:07 
AnswerRe: Handling .class files in C# Pin
g00fyman4-Oct-05 3:19
g00fyman4-Oct-05 3:19 

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.