These methods provide the functionality that existed in the feMedia class,
and call the correct code for the specific version of Windows Media Player that
is being used. When using the old Windows Media 6.4 and earlier interfaces the
functionality remains unchanged, and all existing code work. The object will
automatically try use the newest interfaces available and fall back to the
previous interfaces if they are not available.
When using the new Media Player 7 and later
interfaces, as much as possible we have maintained transparent backward
compatibility, however some code may cease to work, in all cases where
deprecated functionality is used with the new control the method will call the
ErrorTrap() method with the warning or error.
To display ErrorTrap messages set
the .logging property of the class to 1 and the .level property to the level of
logging required (0 for errors only, 1 to include warnings and 2 for all
messages including errors, warnings and information). The output can then be
viewed using the free DebugView utility from Microsoft (
EventCallback (long EventID,
string Parm1, string Parm2, string Parm3, string Parm4), long
Main Callback method for handling events. Can be used to
trap and handle events.
Parameters
Parameter |
Description |
eventID | The ID of the event. The TranslateEventID method can be
used to convert an event ID into a string describing the event. See the
Remarks section for all events provided. |
parm1,
parm2, parm3, parm4 | The values of any parameters provided by the event. |
Returns
Zero unless an internal error processing the event occured.
Remarks
See the
How Do I use the callback
section below for details on using this in your code
The follow events are provided by the Media Player
interface (See the Event Parameters section below for a description of
common parameters):
fe:
WMPCOREEVENT_OPENSTATECHANGE
'Open Stated Changed'
fe:
WMPCOREEVENT_STATUSCHANGE 'Status
Changed'
fe:
WMPCOREEVENT_PLAYSTATECHANGE 'Play State
Changed'
fe:
WMPCOREEVENT_AUDIOLANGUAGECHANGE 'Audio
Language Changed'
fe:
WMPCOREEVENT_SEEK_BASE 'Seek Based'
fe:
WMPCOREEVENT_ENDOFSTREAM 'End Of Stream'
fe:
WMPCOREEVENT_POSITIONCHANGE 'Position
Changed'
fe:
WMPCOREEVENT_MARKERHIT 'Marker Hit'
fe:
WMPCOREEVENT_DURATIONUNITCHANGE
'Durantion Unit Changed'
fe:
WMPCOREEVENT_SCRIPTCOMMAND 'Script
Command'
fe:
WMPCOREEVENT_DISCONNECT 'Disconnected'
fe:
WMPCOREEVENT_BUFFERING 'Buffering'
fe:
WMPCOREEVENT_NEWSTREAM 'New Stream'
fe:
WMPCOREEVENT_ERROR 'Error'
fe:
WMPCOREEVENT_WARNING 'Warning'
fe:
WMPCOREEVENT_CDROMMEDIACHANGE 'CD ROM
Media Changed'
fe:
WMPCOREEVENT_PLAYLISTCHANGE 'Playlist
Changed'
fe:
WMPCOREEVENT_MEDIACHANGE 'Media Changed'
fe:
WMPCOREEVENT_CURRENTMEDIAITEMAVAILABLE
'Current Media Item Available'
fe:
WMPCOREEVENT_CURRENTPLAYLISTCHANGE
'Current Playlist Changed'
fe:
WMPCOREEVENT_CURRENTPLAYLISTITEMAVAILABLE
'Current Playlist Item Available'
fe:
WMPCOREEVENT_CURRENTITEMCHANGE 'Curernt
Item Changed'
fe:
WMPCOREEVENT_MEDIACOLLECTIONCHANGE 'Media
Collection Changed'
fe:
WMPCOREEVENT_MEDIACOLLECTIONATTRIBUTESTRINGADDED
'Media Collection Attributes Changed'
fe:
WMPCOREEVENT_MEDIACOLLECTIONATTRIBUTESTRINGREMOVED
'Media Collection Attribute String Removed'
fe:
WMPCOREEVENT_PLAYLISTCOLLECTIONCHANGE
'Playlist Collection Changed'
fe:
WMPCOREEVENT_PLAYLISTCOLLECTIONPLAYLISTADDED
'Playlist Added'
fe:
WMPCOREEVENT_PLAYLISTCOLLECTIONPLAYLISTREMOVED
'Playlist Removed'
fe:
WMPCOREEVENT_MEDIACOLLECTIONCONTENTSCANADDEDITEM
'Content Scan Added Item'
fe:
WMPCOREEVENT_MEDIACOLLECTIONCONTENTSCANPROGRESS
'Content Scan Progress'
fe:
WMPCOREEVENT_MEDIACOLLECTIONSEARCHFOUNDITEM
'Search Found Item'
fe:
WMPCOREEVENT_MEDIACOLLECTIONSEARCHPROGRESS
'Search Progress'
fe:
WMPCOREEVENT_MEDIACOLLECTIONSEARCHCOMPLETE
'Search Complete'
fe:
WMPCOREEVENT_PLAYLISTCOLLECTIONPLAYLISTSETASDELETED
'Playlist Set As Deleted'
fe:
WMPCOREEVENT_MODECHANGE 'Mode Changed'
fe:
WMPCOREEVENT_MEDIACOLLECTIONATTRIBUTESTRINGCHANGED
'Attribute String Changed'
fe:
WMPCOREEVENT_MEDIAERROR 'Media Error'
fe:
WMPCOREEVENT_DOMAINCHANGE 'Domain
Changed'
fe:
WMPCOREEVENT_OPENPLAYLISTSWITCH 'Open
Playlist Switch'
fe:
WMPCOREEVENT_STRINGCOLLECTIONCHANGE
'String Collection Changed'
fe:
WMPCOREEVENT_MEDIACOLLECTIONMEDIAADDED
'Media Added'
fe:
WMPCOREEVENT_MEDIACOLLECTIONMEDIAREMOVED
'Media Removed'
Event Parameters
The following events provide parameters which contain
additional information. The types listed below are converted to Clarion
strings and passed as parm1, parm2, parm3 and parm4. Parameters listed below
as BSTR types and bstrings, which are converted to standard Clarion strings.
An event which has one parameter will pass that value in
parm1, and the remaining passed parameters will be empty strings. Events
with two parameters pass the values in
parm1 and
parm2, three values in
parm1,
parm2,
parm3
and so on.
fe:
WMPCOREEVENT_OPENSTATECHANGE
(long newState)
The
OpenStateChange event occurs when the Windows
Media Player control changes state.
newState is one of the following
WMPPlayState
values:
wmppsUndefined = 0,
wmppsStopped = 1,
wmppsPaused = 2,
wmppsPlaying = 3,
wmppsScanForward = 4,
wmppsScanReverse = 5,
wmppsBuffering = 6,
wmppsWaiting = 7,
wmppsMediaEnded = 8,
wmppsTransitioning = 9,
wmppsReady = 10,
wmppsReconnecting = 11,
wmppsLast = 12
fe:
WMPCOREEVENT_PLAYSTATECHANGE
(long newState)
The
PlayStateChange event occurs when the play
state of the Windows Media Player control changes.
newState is one of the
WMPPlayState
values listed above.
fe:
WMPCOREEVENT_AUDIOLANGUAGECHANGE
(long LangID)
The
AudioLanguageChange event occurs when the
current audio language changes. A
LangID uniquely identifies a
particular language dialect, called a locale
fe:
WMPCOREEVENT_ENDOFSTREAM
(long Result)
The
EndOfStream event is reserved for future use.
of fe:
WMPCOREEVENT_POSITIONCHANGE
(double oldPosition, double newPosition)
The
PositionChange event occurs when the current
playback position within the media item has been changed.
oldPosition
Specifies the original position.
newPosition
Specifies the new position.
fe:
WMPCOREEVENT_MARKERHIT
(double oldPosition, double newPosition)
The
MarkerHit event occurs when a marker is reached.
MarkerNum
[in] Specifies the number of the marker that was hit.
fe:
WMPCOREEVENT_DURATIONUNITCHANGE
(long NewDurationUnit)
The
DurationUnitChange event is reserved for
future use
fe:
WMPCOREEVENT_SCRIPTCOMMAND
(BSTR scType, BSTR Param)
The
ScriptCommand event occurs when a synchronized
command or URL is received.
scType
Specifies the type of script command.
Param
Specifies the script command
fe:
WMPCOREEVENT_DISCONNECT
(long Result)
The
Disconnect event is reserved for future use.
fe:
WMPCOREEVENT_BUFFERING
(VARIANT_BOOL Start)
The
Buffering event occurs when the Windows Media
Player control begins or ends buffering
fe:
WMPCOREEVENT_WARNING
(long WarningType, long Param, BSTR Description)
The Warning event is reserved for future use.
fe:
WMPCOREEVENT_CDROMMEDIACHANGE
(long CdromNum)
The
CdromMediaChange event occurs when a CD or DVD
is inserted into or ejected from a CD or DVD drive. CdromNum Specifies the
index of the CD or DVD drive
fe:
WMPCOREEVENT_CURRENTMEDIAITEMAVAILABLE
(BSTR bstrItemName)
The
CurrentMediaItemAvailable event occurs when
the current media item becomes available.
bstrItemName
Specifies the item name.
fe:
WMPCOREEVENT_CURRENTPLAYLISTITEMAVAILABLE
(BSTR bstrItemName)
The
CurrentPlaylistItemAvailable event occurs when
the current playlist item becomes available.
bstrItemName
Specifies the item name.
fe:
WMPCOREEVENT_MEDIACOLLECTIONATTRIBUTESTRINGADDED
(BSTR bstrAttribName, BSTR bstrAttribVal)
The
MediaCollectionAttributeStringAdded event
occurs when an attribute is added to
Media Library.
bstrAttribName
Specifies the attribute name. For information about
the attributes supported by Windows Media Player, see the Windows Media
Player
Attribute Reference.
bstrAttribVal
Specifies the attribute value.
fe:
WMPCOREEVENT_MEDIACOLLECTIONATTRIBUTESTRINGREMOVED
(BSTR bstrAttribName, BSTR bstrAttribVal)
The
MediaCollectionAttributeStringRemoved event
occurs when an attribute is removed from
Media Library. .
bstrAttribName
Specifies the attribute name. For information about
the attributes supported by Windows Media Player, see the Windows Media
Player
Attribute Reference.
bstrAttribVal
Specifies the attribute value.
fe:
WMPCOREEVENT_PLAYLISTCOLLECTIONPLAYLISTADDED
(BSTR bstrPlaylistName)
The
PlaylistCollectionPlaylistAdded event occurs
when a playlist is added to the playlist collection.
bstrPlaylistName
Specifies the name of the playlist that was added.
fe:
WMPCOREEVENT_PLAYLISTCOLLECTIONPLAYLISTREMOVED
(BSTR bstrPlaylistName)
The
PlaylistCollectionPlaylistRemoved event occurs
when a playlist is removed from the playlist collection.
bstrPlaylistName
Specifies the name of the playlist that was removed.
fe:
WMPCOREEVENT_MODECHANGE
(BSTR ModeName, VARIANT_BOOL NewValue)
The
ModeChange event occurs when a mode of the player is changed.
ModeName
Specifies the mode that was changed. Contains one
of the following values.
Value | Description |
shuffle | Tracks are played in random order. |
loop | The entire sequence of tracks is played repeatedly |
fe:
WMPCOREEVENT_MEDIACOLLECTIONATTRIBUTESTRINGCHANGED
(BSTR bstrAttribName, BSTR bstrOldAttribVal, BSTR
bstrNewAttribVal)
The
MediaCollectionAttributeStringChanged
bstrAttribName
Specifies the name of the attribute. For
information about the attributes supported by Windows Media Player, see the
Windows Media Player
Attribute Reference.
bstrOldAttribVal
Specifies the original attribute value.
bstrNewAttribVal
Specifies the new attribute value.
fe:
WMPCOREEVENT_DOMAINCHANGE
(BSTR strDomain)
The DomainChange event occurs when the DVD domain
changes.
strDomain
[in] Specifies the new domain. It can be one of the
following values:
String | Description |
firstPlay | Performing default initialization of a DVD disc. |
videoManagerMenu | Displaying menus for whole disc. Also known as Root
Menu or topMenu. |
videoTitleSetMenu | Displaying menus for current title set. Also known
as titleMenu |
title | Displaying the current title. |
stop | The DVD Navigator is in the DVD Stop domain. |
fe:
WMPOCXEVENT_CLICK
(short nButton, short nShiftState, long fX, long fY)
nButton
A bit field with bits corresponding to the left button
(bit 0), right button (bit 1), and middle button (bit 2). These bits
correspond to the values 1, 2, and 4, respectively. Only one of the bits is
set, indicating the button that caused the event.
nShiftState
A bit field with the least significant bits
corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT
key (bit 2). These bits correspond to the values 1, 2, and 4, respectively.
The shift argument indicates the state of these keys. Some, all, or none of
the bits can be set, indicating that some, all, or none of the keys are
pressed..
fX
The
x coordinate of the mouse pointer
relative to the upper-left corner of the control.
fY
The
y coordinate of the mouse pointer relative to
the upper-left corner of the control.
fe:
WMPOCXEVENT_DOUBLECLICK
(short nButton, short nShiftState, long fX, long fY)
See
WMPOCXEVENT_CLICK above for a
description of the parameters.
fe:
WMPOCXEVENT_KEYDOWN
(short nKeyCode, short nShiftState)
The
KeyDown event occurs when a key is pressed.
nKeyCode
Specifies which physical key is pressed. For possible
values, see the Remarks section.
nShiftState
A bit field with the least significant bits
corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT
key (bit 2). These bits correspond to the values 1, 2, and 4, respectively.
The shift argument indicates the state of these keys. Some, all, or none of
the bits can be set, indicating that some, all, or none of the keys are
pressed.
fe:
WMPOCXEVENT_KEYPRESS
(short nKeyAscii)
The
KeyPress event occurs when a key is pressed
and then released.
nKeyAscii
Specifies the standard numeric ANSI code for the character.
fe:
WMPOCXEVENT_KEYUP
(short nKeyCode, short nShiftState)
The
KeyUp event occurs when a key is released.
nKeyCode
Specifies which physical key is pressed. For
possible values, see the Remarks section of the
KeyDown event.
nShiftState
A bit field with the least significant bits
corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT
key (bit 2). These bits correspond to the values 1, 2, and 4, respectively.
The shift argument indicates the state of these keys. Some, all, or none of
the bits can be set, indicating that some, all, or none of the keys are
pressed.
fe:
WMPOCXEVENT_MOUSEDOWN
(short nButton, short nShiftState, long fX, long fY)
The
MouseDown event occurs when a mouse button is
pressed.
nButton
[in] A bit field with bits corresponding to the left
button (bit 0), right button (bit 1), and middle button (bit 2). These bits
correspond to the values 1, 2, and 4, respectively. Only one of the bits is
set, indicating the button that caused the event.
nShiftState
[in] A bit field with the least significant bits
corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT
key (bit 2). These bits correspond to the values 1, 2, and 4, respectively.
The shift argument indicates the state of these keys. Some, all, or none of
the bits can be set, indicating that some, all, or none of the keys are
pressed.
fX
[in] The
x coordinate of the mouse pointer
relative to the upper-left corner of the control.
fY
[in] The
y coordinate of the mouse pointer
relative to the upper-left corner of the control.
fe:
WMPOCXEVENT_MOUSEMOVE
(short nButton, short nShiftState, long fX, long fY)
The
MouseMove event occurs when the mouse pointer
is moved.
nButton
[in] A bit field with bits corresponding to the left
button (bit 0), right button (bit 1), and middle button (bit 2). These bits
correspond to the values 1, 2, and 4, respectively. Some, all, or none of
the bits can be set, indicating that some, all, or none of the buttons are
pressed.
nShiftState
[in] A bit field with the least significant bits
corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT
key (bit 2). These bits correspond to the values 1, 2, and 4, respectively.
The shift argument indicates the state of these keys. Some, all, or none of
the bits can be set, indicating that some, all, or none of the keys are
pressed.
fX
[in] The
x coordinate of the mouse pointer
relative to the upper-left corner of the control.
fY
[in] The
y coordinate of the mouse pointer
relative to the upper-left corner of the control.
fe:
WMPOCXEVENT_MOUSEUP
(short nButton, short nShiftState, long fX, long fY)
The
MouseUp event occurs when a mouse button is
released.
nButton
[in] A bit field with bits corresponding to the left
button (bit 0), right button (bit 1), and middle button (bit 2). These bits
correspond to the values 1, 2, and 4, respectively. Only one of the bits is
set, indicating the button that caused the event.
nShiftState
[in] A bit field with the least significant bits
corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT
key (bit 2). These bits correspond to the values 1, 2, and 4, respectively.
The shift argument indicates the state of these keys. Some, all, or none of
the bits can be set, indicating that some, all, or none of the keys are
pressed.
fX
[in] The
x coordinate of the mouse pointer
relative to the upper-left corner of the control.
fY
[in] The
y coordinate of the mouse pointer
relative to the upper-left corner of the control.
How Do I use the
callback
You need to derive the EventCallback method in your source code editor of
your FEControl procedure. This is shown in the MediaSoundEvents procedure of
the feabc example application. Typically the events that you'd be interested
in, is paused, stopped and ended, which can be trapped as follows:
if EventID = fe:WMPCOREEVENT_PLAYSTATECHANGE
case Parm1
of 1 !Stopped
!This is the event you're interested in if the
user stops the track. It also occurs after the track is finished playing.
of 2 !Paused
of 3 !Started
of 8 !Ended
!This is the event you're interested in if the
media finishes playing.
of 9 !Transitioning
end
end