我在工程中使用Media Player控件,现在遇到一个这样的问题,如何得到我正在播放的文件的播放位置
我添加了OnPositionChangeOcxPlayer事件的响应函数,可以得到media player中进度条拖动的位置,但是当文件播放时,我得不到正在播放的位置,谁知道怎么做吗?
我添加了OnPositionChangeOcxPlayer事件的响应函数,可以得到media player中进度条拖动的位置,但是当文件播放时,我得不到正在播放的位置,谁知道怎么做吗?
Control Events
Indicates changes to the current media position, such as when the user selects (or seeks to) a new media position. Private Sub object_PositionChange(ByVal oldPosition As Double, ByVal newPosition As Double)Parameters
object
Object expression that evaluates to an ActiveMovie Control.
oldPosition
Position before it changed, in seconds.
newPosition
Current position, in seconds, after the position change occurred.
Res
Changes made directly to the CurrentPosition property do not trigger this event.
Control Properties
Specifies the current position within the multimedia stream, in seconds. [form.]object.CurrentPosition [ = double ]Res
The new value must be within the range specified by the SelectionStart and SelectionEnd properties. The current position value displayed by the control's user interface can represent either seconds or frames. The DisplayMode property determines the units shown. Setting the CurrentPosition property at run time is similar to a seek operation and changes the position to the specified point in the multimedia stream. Run-time access: read/write. Design-time access: not applicable. Settings Setting Description
double New position within the stream, in seconds.
Data Type double
LONGLONG llPosition = 0;
pMS->GetCurrentPosition(&llPosition);
{
double result;
InvokeHelper(0x403, DISPATCH_PROPERTYGET, VT_R8, (void*)&result, NULL);
return result;
}
这个函数可以得到。不管什么时候都可以。