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 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