With the window painter open, select the OLE object. This will bring up the window to select the type of OLE object you want to embedd on the window. Scroll down on the "Create New" tab until you see "Windows Media Player", and select it, and then click the "OK" button. Then place it on the window. For future reference, I named this object "ax". Why? It comes from when I first started messing around with the object a few years back in VisualBasic, and it was defaulted to "axMediaPlayer_1"... I shortened it to "ax" because I'm lazy. So in the future, any code relating to ax.SomeFunctionality( ) is referring to this object.
Let's say you have the path to an MP3 file, which is: "C:\Music\myMusicFile.mp3", and it is stored in the variable ls_path. To play this file, all you have to do is set ax's URL property. So,
ax.Object.URL = ls_path
This is supposing that you have not set ax's AutoStart property from its default of TRUE. Personally, I don't like anything to start without me telling it to, so in the open event of my window, I set the AutoStart property:
ax.Object.Settings.AutoStart = FALSE
So now, when the URL property is assigned, how do we get it to play? Easy...
Pausing playback is very straightforward as well. In this example, suppose we have a button named "cb_pause", and when ax is playing, we can hit this button to pause playback, and hit it again to resume where we paused at. In the Clicked! event of cb_pause:
Long ll_state
ll_state = ax.Object.PlayState
CHOOSE CASE ll_state CASE 2 //ax is paused ax.Object.Controls.Play( )
CASE 3 //ax is playing ax.Object.Controls.Pause( )
CASE ELSE //no action needed... The ELSE statement itself isn't needed