Visual Basic.net

burnzie

Newbie
Joined
Jul 8, 2003
Messages
3,487
Reaction score
0
this may be the wrong forum, but its more active than the other more fitting forum. and i need help now :D

i am trying to get a sound file to load into my media player component. it is for an alarm so i dont want it playing all the time, only when it reaches the set time.

i dont want it to loop either, just play once.

i had it working once but i lost the program i built and now i need it for an assignment. i have forgotten exactly how it is done. i know that i can pre load the sound file into the forms load function, set the file to play once and get it to play when the set time is reached. but i have no idea of the code in which to do it.

Do any people know visbas.net here??

your help and time would be greatly appreciated.

please only post if you think you have some information to help me.

:cheers:
 
im gonna try and make sure its at the top of the list for a bit
 
it just got locked in coding and... aww to late. :(
 
this is for a clock, the user can set the time in a text box and it checks the clock text box untill a match is found, thus sounding the alarm.

everything is fine apart from the imbeded mediaplayer, wich needs a sound, not to loop and not to play as soon as its loaded, but play whent the clock reached the alarm time.

basicly i need a line of code to

1. stop mediaplayer from auto looping
2.load the file, but not play


i know how to get it to play when the alarm is reached, but i have no file to play
 
Place a button on the form and a media control COM onto the form.

Within the "FORM LOAD" procedure type the following:

Private Sub Form1_Load (Byval sender as system.object, byval e as system.eventargs) handles mybase.load
' The code to be added.....
AxWindowsMediaPlayer1.uiMode = "invisible" ' Make media player invisible
AxWindowsMediaPlayer1.settings.autostart(False) ' Do not play media upon start.
End Sub

Private Sub Button1_Click(Byval sender ....... as the default....
' The code to be added....
' Ideally this would be linked to an open dialog box or something.....
AxWindowsMediaPlayer1.URL = "C:\\test.wav" ' or whatever file you want to load
' Handle Playstates.....
if (AxWindowsMediaPlayer1.playstate = WMPLib.WMPPlayState.WmppsStopped) or (AXWindowsmediaPlayer1.Playstate = WMPLib.WMPPlayState.WmppsMediaEnded) Then
AxWindowsMediaPlayer1.CtlControls.Play()
end if
End Sub

Mind you this is from memory. There are a couple of pages of info on it if you type AXWindowsMediaPlayer into google or use Visual Studio Help....

Your media player might also be an older version of the one i am using in which case it might be called MediaPlayer1 - however the function I think (????) will be the same.
 
Back
Top