Easy question, I defined a command button to run ocx components. for example: Windows Media Player I have defined 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. [Duh!] I’m affraid I don’t know which properties should be initialized for command button to make it works. Anyone could figure this out? [B)] Thanks in advance. Jemmy
Hi, First Line of code must have to create instance of specified Automation variable. So please add this code CREATE(WindowsMediaPlayer); and then try.
Hi Rajesh, It doesn’t work since I used variable with datatype = OCX. After I put CREATE (WindowsMediaPlayer), it will give error message: Type conversion is not possible because 1 of the operators contain an invalid type Automation := OCX Any other advises? [B)]
Out of pure boredom, I thought I would try this out for 5 minutes, and although so far I cannot get the display to show, I can get it to play music ! Like Rajesh said, it has to be a variable of type automation. The automation variable I used was : ‘Windows Media Player’.MediaPlayer You have to create it CREATE(WindowsMediaPlayer); then all the rest is just selecting the right method to call (your listing above works without modification). The file has to exist for it to play anything, but if you want to check its doing something, add: WindowsMediaPlayer.AboutBox(); which shows the about dialogbox! Regards, edd ps. I will keep trying this out in my spare time, but I have to be careful, as my laptop just started blaring U2 in front of the office just now!