Easy question, I defined a command button to run ocx components.
for example: Windows Media Player
I have defined
WindowsMediaPlayer as variables with datatype = OCX and subtype refers to Windows Media Player.
Then I put OnPush trigger with following codes:
WindowsMediaPlayer.Autostart := TRUE;
WindowsMediaPlayer.ShowDisplay := TRUE;
WindowsMediaPlayer.AnimationAtStart := TRUE;
WindowsMediaPlayer.Open ('C:\file.wmv');
But after I press the button, nothing happened. :x
I'm affraid I don't know which properties should be initialized for command button to make it works.
Anyone could figure/advise this out? :roll:
Thanks in advance.
Jemmy
ps. please don't suggest to put the code in the unit code, since it will works.
Comments
Can you see windows media player in the process list (ctrl+alt+del)?
If so, there might be an additional property that still hides media player.
Try something like:
WindowsMediaPlayer.Visible := TRUE;
Dont know if that excists but for most applications like word and excel this property has to be set first before the application becomes visible.
I can't find WindowsMediaPlayer application running in the Windows Task Manager. :x
I also have tried to put WindowsMediaPlayer.Visible := True, but unfortunately it will generate error after I recompile the form.
It will display:
You have specified an unknown variable
Visible
So I think visible is not a property of WindowsMediaPlayer ocx.
Am I wrong in defining PushAction property of the button? :?:
Please help, Thanks again. :roll:
HTH,
Jemmy
There may be cases that the push trigger doesn't get fired when some properties of the button are set but don't exactly know which. The behavior you describe may be result of you using an existing button instead of making a new one. Is that right?
If so, create a new one from the toolbox. This will get you the default properties which should work fine.
- Create New Form (empty)
- Toolbox: Add Button
- C/AL Code -> in de OnPush put: WMP.openPlayer('c:\bla.wmv');
- Register a Global Var:
Name: WMP
Type: OCX
SubType: Windows Media Player
- CTRL-R
- Press the button
works fine here ..
(after you added the global var you can see what properties and methods the WMP Variable has when you press F5 and select WMP in the outer left list)
gl
GAC Business Solutions B.V.
http://www.BiloBeauty.com
http://www.autismspeaks.org
thanks for all your sharings..
here's my further test:
It plays but does not show! :roll:
when I assigned
WindowsMediaPlayer.Open ('song.mp3');
I heard the sound of 'song.mp3'! But The window of Windows Media Player didn't show.
I have tried to set all similiar properties like
ShowControl, Showtracker, Showgotobar, ShowStatusBar, etc to TRUE.
But it still can't show anything.
So nothing wrong with the command button.
Is this the limitation of ocx in Navision 3.7? :?
HTH,
When i do :
WMP.openPlayer('c:\temp\taz.wav');
This works fine.
WMP = OCX var of type : "Windows Media Player"
I have Win XP an WMP 9.0
Gozh, you are right! I think I used the different .dll.
I used Windows Media Player 8, and Windows 2000 Server.
After I install Windows Media Player 9 series, I got the method like
OpenPlayer, newMedia, close, launchURL, newPlayList
And it works well now.
The window of media player is shown!
So the conclusion is Windows Media Player 8 doesn't work for Navision 8)
Case closed.
Thanks.
Jemmy
anyway, yw
GAC Business Solutions B.V.