D
D
Dexaid2282021-02-05 19:43:52
WPF
Dexaid228, 2021-02-05 19:43:52

Why does a WPF application just shut down when it should play sound for no reason?

The problem is that everything is fine at startup, but when you press the button, the music is not played, but the program is turned off simply for no reason, this is not the first time for me and I did not find anything in Google, help, who knows please.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Media;

namespace Music
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            SoundPlayer simpleSound = new SoundPlayer(@"d:\ATL - Всего лишь мертвецы");
            simpleSound.Play();
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2021-02-05
@hottabxp

Do you have a file ATL - Всего лишь мертвецыexactly in wav format and without extension?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question