private void Form1_Load(object sender, EventArgs e) { g_MediaPlayer = new CMediaPlayer(this); try { g_MediaPlayer.Initialize(); } catch { MessageBox.Show(this, "Unable to initialize media player", "Initialization Failure", MessageBoxButtons.OK); Close(); } IDC_SLIDER_VOLUME.Value = (int)(g_MediaPlayer.Volume * 100.0f); IDC_CHECK_MUTE.Checked = g_MediaPlayer.Mute; }
protected override void OnClosing(CancelEventArgs e) { g_MediaPlayer.Shutdown(); g_MediaPlayer = default; base.OnClosing(e); }