stopping and starting for each loop array in visual basic
i have a for each loop i.e
For Each dgvRow In boutgrid.Rows
file = dgvRow.Cells("FileName").Value
AxWindowsMediaPlayer1.url = file开发者_运维问答
AxWindowsMediaPlayer1.Ctlcontrols.play()
Next
if want that the loop stops while the player play a file until finished playback
Just doing some Googlefoo on the AXWindowsMediaPlayer class, you ought to be able to get the duration. The AxWindowsMediaPlayer class has a currentMedia field which has a get_duration member which returns the duration in seconds.
Then call System.Threading.Thread.Sleep(Duration * 1000) because the get_duration returns seconds, and Thread.Sleep is in miliseconds.
精彩评论