PDA

View Full Version : Solved: About Windows Media Player on UserForm



Erdin? E. Ka
12-16-2006, 02:31 PM
Hi everyone, :hi:

I want to unload UserForm1 when Windows Media Player (On UserForm1) if movie (current) file is finished (auto-stop). What should i do?

I found some useful codes at the link below but those knowledges aren't about my problem.

http://silkyroad.developpez.com/VBA/WindowsMediaPlayer/
http://www.codeguru.com/forum/archive/index.php/t-386130.html

By the way, i attached my file.

tstom
12-16-2006, 05:49 PM
It does stop on it's own. Do you have repeat or shuffle on?

Erdin? E. Ka
12-16-2006, 06:14 PM
It does stop on it's own. Do you have repeat or shuffle on?

Hi tstom i am sorry,:think:

I wrote my problem wrong. :dunno Excuse me. Today i am a little tired. :(

I want to close UserForm1 when movie finished. (Not auto-stop movie)

Sorry to all members.

tstom
12-16-2006, 06:49 PM
Use this event.


Private Sub WindowsMediaPlayer1_StatusChange()
If WindowsMediaPlayer1.Status = "Stopped" Then Unload Me
End Sub

Erdin? E. Ka
12-16-2006, 06:52 PM
Use this event.


Private Sub WindowsMediaPlayer1_StatusChange()
If WindowsMediaPlayer1.Status = "Stopped" Then Unload Me
End Sub



Perfect!:p

Thank you tstom. :friends:

tstom
12-16-2006, 06:53 PM
If you do not want the form unloaded when the stop button is clicked, then use this code...


'module level variable
Private StopButtonClicked As Boolean

Private Sub CommandButton3_Click()
'STOP
StopButtonClicked = True
WindowsMediaPlayer1.Controls.stop
End Sub

Private Sub WindowsMediaPlayer1_StatusChange()
If Not StopButtonClicked Then
If WindowsMediaPlayer1.Status = "Stopped" Then Unload Me
Else
StopButtonClicked = False
End If
End Sub

Erdin? E. Ka
12-16-2006, 08:15 PM
Hi tstom, this code is better.:haha: Thanks a lot.