Skip to Content

One of the things I missed a few times in ABAP was playing a sound. Not that it would be very important in my daily work but it’s one way to give the user a feedback. Think of a loud “tada” when selection has ended, ALV is displayed and the user needs to be woken up … 😉

Thanks to Enno Wulff’s contribution on I <heart> ABAP, I remembered using ABAP and OLE in several projects to access data from Excel and Outlook. But somehow I never checked wether Windows Media Player can be controlled by OLE. The answer is “yes”, here is the documentation (check “Object Model Reference“).

I wrote a little demo which you can get from GitHub. My goal was to play/stop music file “C:\Windows\Media\town.mid” when pushbutton is pressed.Therefore just two pushbuttons in the demo:

With the Microsoft documentation I think it’s easy to enhance my class so you can increase volume.

As preperation you have to register Windows Media Player in transaction SOLE as an OLE application once. You can choose your own name for the OLE application. I used “WMP”. Furthermore a ClassID is needed which I took from the Microsoft Answers Forum. It’s {6BF52A52-394A-11d3-B153-00C04F79FAA6}. On my Windows 7 and Windows 10 installation that worked fine.

 

Have fun trying it and see you soon

Michael

 

 

 

To report this post you need to login first.

10 Comments

You must be Logged on to comment or reply to a post.

    1. Michael Keller Post author

      Great idea. So I don’t have to buy radioplay. Now I can listen to longtext of error messages. Just a joke 😉 That’s another interesting technology. Thanks for the note.

      (0) 
      1. Enno Wulff

        Yes, but also annoying.

        I tried here to  guide a user through a “form” and enter data. Merlin reacted not very good and fast on field changes or keyboard input.

        Nowadays with more experience with gui controls it might be nice to let Merlin pop up when the user clicks on tree nodes or tab…

        (0) 

Leave a Reply