Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. WindowsMediaPlayer wmp = new WindowsMediaPlayer();
  2. wmp.URL = "music.mp3";
  3. wmp.controls.play();
  4.  
  5. WindowsMediaPlayer wmp = new WindowsMediaPlayer();
  6. Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PostGen.Resources.Kalimba.mp3");
  7. using (Stream output = new FileStream ("C:\temp.mp3", FileMode.Create))
  8. {
  9. byte[] buffer = new byte[32*1024];
  10. int read;
  11.  
  12. while ( (read= stream.Read(buffer, 0, buffer.Length)) > 0)
  13. {
  14. output.Write(buffer, 0, read);
  15. }
  16. }
  17. wmp.URL = "C:\temp.mp3";
  18. wmp.controls.play();
  19.  
  20. private void Form1_FormClosing(object sender, FormClosingEventArgs e)
  21. {
  22. File.Delete("C:\temp.mp3");
  23. }
  24.  
  25. using (Stream output = new FileStream("C:\temp.mp3", FileMode.Create))
  26. {
  27. output.Write(Properties.Resources.notification_mp3, 0, Properties.Resources.notification_mp3.Length);
  28. }
  29. WindowsMediaPlayer wmp = new WindowsMediaPlayer();
  30. wmp.URL = "C:\temp.mp3";
  31. wmp.controls.play();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement