Bug 的个人资料封印的九尾照片日志列表更多 工具 帮助

日志


2009/8/25

matlab GUI调用MediaPlayer播放AVI的尝试

先看了《精通MATLAB GUI设计》 5.4.2的AVI文件执行
按其所说,无效
而后按照http://www.ilovematlab.cn/viewthread.php?tid=46&extra=page%3D1 这里的视频教程编写:
function open_menu_Callback(hObject, eventdata, handles)

[FileName,PathName,FilterIndex] = uigetfile({'*.avi','M-file (*.avi)'},'Choose a video');
if ~FileName
    return
end
%Get the handle to the MediaPlayer. This is a child object of the MovieControl.
mp = handles.MovieControl.MediaPlayer;
%Call the "Open" method on the MediaPlayer to load a file.
Open(mp,[Pathname Filename]);
 

function play_video_Callback(hObject, eventdata, handles)

pos = [0 0 0 0];
feature('COM_ActxProgidCheck',0);
MovieControl = actxcontrol('WMPlayer.OCX.7',pos);

%Store handle in handles structure
handles.MovieControl = MovieControl;
mp = handles.MovieControl.MediaPlayer;
handles.output = mp;
guidata(hObject, handles);

这是两个主要菜单函数
不过发现有 Reference to non-existent field 'MovieControl' 错误,而且一搜索大家都是这个错。
这个视频教程是07年11月制作,而我现在用的是matlab2007a,是2007年1月29日的版本,难道是matlab版本问题?
发现一个朋友如此回答:
 
论坛教学视频使用的MATAB版本较早,应该是7.0左右。而现在新的版本(R2006a以后)对控件应用进行了修改:
Compatibility Considerations

Before the validation check was added, some server ProgIDs worked with actxcontrol , probably because there are cases where Microsoft software points the server GUID to a control GUID underneath. An example of a ProgID that might not work with actxcontrol is the Windows Media® Player server ProgID Mediaplayer.mediaplayer.1. Therefore, depending on how Microsoft software registers the control, the following command might now return an error:

h = actxcontrol('Mediaplayer.mediaplayer.1'); % Returns an error

The correct ProgID to use for Mediaplayer is the ActiveX® control ProgID:

h = actxcontrol('WMPlayer.OCX.7'); % Use control ProgID

Note that methods and properties to open and play files are different when using the control ProgID.

You can disable the validation check with the following command:

feature('COM_ActxProgidCheck',0)

Or reenable it with:

feature('COM_ActxProgidCheck',1)

By default, ProgID checking is on.

6楼应该是用了较新版本的MATLAB才产生上述错误。
 
 
 
不管他说的早晚是不是颠倒了,试过之后仍然无效,是微软的问题么?换来换去干嘛呢。。。
本来想做个好点的GUI,现在视频就算了呃,看着不够炫就找微软吧~
如果有朋友知道如何解决请告知,不胜感谢