Question - Command Button to run ocx components.

jemmy
Member Posts: 247
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:
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.
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.

0
Comments
-
Probably your code is executed but doesn't give the result you think it should.
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.In a world without Borders or Fences, who needs Windows and Gates?0 -
Hi JanPieter,
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,
Jemmy0 -
as far as i know you can just drag a button on a form from the toolbox and standard the C/AL code underneath it gets executed.
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.In a world without Borders or Fences, who needs Windows and Gates?0 -
I tested it with Navision 4.0 NL tho, but oke here's what i did:
- 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)
glM Stunnenberg
GAC Business Solutions B.V.0 -
-
Folks,
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,0 -
Think you are using the wrong library. I dont have all these properties you describe.
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.0In a world without Borders or Fences, who needs Windows and Gates?0 -
Hi JanPieter,
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.
Jemmy0 -
Hmmz, strange that WMP 8 doesn't work.
anyway, ywM Stunnenberg
GAC Business Solutions B.V.0 -
I think it is suspended version of Media Player.DDE functions in Navision0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions