Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

windows media player activex in matlab

Status
Not open for further replies.

farhadjamali

Newbie level 6
Joined
Nov 25, 2008
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,373
Hello all

can any1 tell me how is wmp activex is used in matlab gui i need it in my project. i have too read an audio or video file in matlab gui using WMP activex control. i can't handle it's properties . or simply i can't assign audio files to WMP

thx
Regards.
Farhad Jamali
 

thx dear but i ve already seen that WMP GUI from mathworks unfortunatly i couldnt get understand that. i just want to know the complete description of WMP activex callback functions and properties. specifically how do i command WMP activex to take an audio file from matlab directory and simply play it when it is invoked.

Regards

Farhad Jamali
 

Here you find a simple Matlab code for that

Code:
m=figure;
h=actxcontrol('WMPlayer.OCX.7', [0 0 300 300], m);
[filename pathname] = uigetfile('*.*','Please select a file')
h.URL=[pathname filename];
h.controls.play;
If you need to list down the methods then you can use

Code:
methodsview(h.controls)
then it will show all methods which bind to the control as below


hope this help

regards
bassa
 
Thank you very much dear it works
Now i got it and finaly implement WMP in my GUI.

I ve some others query regarding matlab GUI

i ve plotted more than 1 plot in a single axes .
1) plz tell me how do know handles to every plot which is plotted in the axes.
2) also how can i read plot values directly from plot itself (both x and y) not from the the actual data for plot(before plotting)


Regards
Farhad Jamali
 

farhadjamali said:
1) plz tell me how do know handles to every plot which is plotted in the axes.
I could not understand the question

farhadjamali said:
2) also how can i read plot values directly from plot itself (both x and y) not from the the actual data for plot(before plotting)
You may try this Matlab code (assume following function as you need)

Code:
x=1:5;
y=rand(size(x));
lh=line(x,y);
xp=get(lh,'xdata'); %get x data points
yp=get(lh,'ydata'); %get y data points

% print result

[x;xp]
[y;yp]

hope this help

regards
bassa
 
actully i have plotted 3 graphs in a single axes i.e
a=plot(t,d2);
hold on
a=plot(t,d3);
a=plot(t,d1);

in my gui i ve build a table and an axes(axes contains 3 plots) task which i wonna perform is to extract data from all the three plots of axes and to put them in table

Thx....

Regards

Farhad Jamali
 

You may try this code

Code:
% assume your functions as below
t = 1:5;
d1 = rand(size(x));
d2 = rand(size(x));
d3 = rand(size(x));

a=plot(t,d2);
yp_d2=get(a,'ydata'); %get y data points of d2
hold on
a=plot(t,d3);
yp_d3=get(a,'ydata'); %get y data points of d3
a=plot(t,d1);
yp_d1=get(a,'ydata'); %get y data points of d1

xp=get(a,'xdata'); %get x data points of all

% you can insert following results to your table
[t;xp]
[d1;yp_d1]
[d2;yp_d2]
[d3;yp_d3]

hope this help

regards
bassa
 
yes dear it works thank u very much



Regards

Farhad Jamali

Added after 1 hours 31 minutes:

Brother

WMP is working fine when i run my gui in matlab envirnoment.
i ve created exe of my GUI using matlab deploytool every thing goes fine here
but WMP in not functioning in exe form of my GUI

any suggestion plz


Regards
Farhad Jamali
 

You may need Run-Time Licenses. Refer this **broken link removed**

it says

When you deploy a Microsoft ActiveX control that requires a run-time license, you must include a license key, which the control reads at run-time. If the key matches the control's own version of the license key, an instance of the control is created. Use the following procedure to deploy a run-time-licensed control with a MATLAB application.
Build the Control and the License File

Change to the folder where you placed the function you created to build the control. Call the function. When it executes this function, MATLAB determines whether the control requires a run-time license. If it does, MATLAB creates another file, named actxlicense.m, in the current working folder. The actxlicense function defined in this file provides the license key to MATLAB at run-time.
Build the Executable

Next, call MATLAB Compiler to create the standalone executable from the file you created to build the control. The executable contains both the function that builds the control and the actxlicense function.

mcc -m buildcontrol

Deploy the Files

Finally, distribute buildcontrol.exe, buildcontrol.ctf, and the control (.ocx or .dll).

regards
bassa
 
what if i run my GUI on system with older OS and WMP will it work for them.i.e
I ve windows 7 and it's ver. 12 WMP. and my target pc may have different ver. of OS(Windows XP for instance) and older WMPs.

Added after 5 hours 9 minutes:

Plz elaborate how do i make these functions and all those license control.
 

farhadjamali said:
what if i run my GUI on system with older OS and WMP will it work for them.i.e
I ve windows 7 and it's ver. 12 WMP. and my target pc may have different ver. of OS(Windows XP for instance) and older WMPs.

You may check **broken link removed**

Actxcontrol Command Now Validates ProgID

Attempting to insert a COM server into a MATLAB figure can result in unpredictable behaviors. To prevent this condition, the actxcontrol command now checks the ProgID by looking at the registry's HKR/CLSID/Control keyword and throws an error if the ProgID does not belong to a Microsoft ActiveX control.
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.


farhadjamali said:
Plz elaborate how do i make these functions and all those license control.
Did you try the above method "Build the Control and the License File"?

Build the Executable

Next, call MATLAB Compiler to create the standalone executable from the file you created to build the control. The executable contains both the function that builds the control and the actxlicense function.

mcc -m buildcontrol
Deploy the Files

Finally, distribute buildcontrol.exe, buildcontrol.ctf, and the control (.ocx or .dll).

regards
bassa
 
brother i couldnt do it.

dear my project is complete except this issue and i m waiting for this to be solved. so plz help me doing these...

plz show me all those functions and license files control files whatever


1) functions for making license files for making exe of GUI with WMP using mcc or matlab deploytool.

2) and checking if the system has the desired ver. of WMP if not how program should respond then(i mean if we implement it as a switch or if-else construct) so that it may report that WMP is not working and selects an alternative.

Thanks dear

Regards

Farhad Jamali
 

farhadjamali said:
1) functions for making license files for making exe of GUI with WMP using mcc or matlab deploytool.
Refer Technical Solutions for more about license

farhadjamali said:
2) and checking if the system has the desired ver. of WMP if not how program should respond then(i mean if we implement it as a switch or if-else construct) so that it may report that WMP is not working and selects an alternative.
Here simple code to for that

Code:
list = actxcontrollist;
for ii = 1:length(list)
if ~isempty(findstr('Windows Media Player',[list{ii,:}]))
s = sprintf(' Name = %s\n ProgID = %s\n File = %s\n', ...
list{ii,:})
end
end
and the result would be

Code:
s =

 Name = Windows Media Player
 ProgID = WMPlayer.OCX.7
 File = C:\WINDOWS\system32\wmp.dll

hope your comments

regards
bassa
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top