Exemple #1
0
 //播放
 public void play()
 {
     TemStr = "";
     TemStr = TemStr.PadLeft(127, Convert.ToChar(" "));
     APIClass.mciSendString("play media", TemStr, TemStr.Length, 0);
     mediaPlayer.state = State.mPlaying;
 }
Exemple #2
0
 public void Pause()
 {
     TemStr            = "";
     TemStr            = TemStr.PadLeft(128, Convert.ToChar(" "));
     ilong             = APIClass.mciSendString("pause media", TemStr, TemStr.Length, 0);
     mediaPlayer.state = State.mPuase;
 }
Exemple #3
0
 //停止
 public void Stop()
 {
     TemStr            = "";
     TemStr            = TemStr.PadLeft(128, Convert.ToChar(" "));
     ilong             = APIClass.mciSendString("close media", TemStr, 128, 0);
     ilong             = APIClass.mciSendString("close all", TemStr, 128, 0);
     mediaPlayer.state = State.mStop;
     if (mediaPlayer.iName.Equals(tmpPath))
     {
         File.Delete(tmpPath);
     }
 }
Exemple #4
0
 private void init(string path)
 {
     try
     {
         TemStr            = "";
         TemStr            = TemStr.PadLeft(127, Convert.ToChar(" "));
         Name              = Name.PadLeft(260, Convert.ToChar(" "));
         mediaPlayer.iName = path;
         ilong             = APIClass.GetShortPathName(mediaPlayer.iName, Name, Name.Length);
         Name              = GetCurrPath(Name);
         Name              = "open " + Convert.ToChar(34) + Name + Convert.ToChar(34) + " alias media";
         ilong             = APIClass.mciSendString("close all", TemStr, TemStr.Length, 0);
         ilong             = APIClass.mciSendString(Name, TemStr, TemStr.Length, 0);
         ilong             = APIClass.mciSendString("set media time format milliseconds", TemStr, TemStr.Length, 0);
         mediaPlayer.state = State.mStop;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }