How to listen to Windows events in C #?

I am developing a lyrics-related application and I need to listen to the events of Windows Media Player. I looked at Windows events in the "Available Event Watcher", and I found out that there are some events that WMP sends every time it changes state or current position. I searched and found this article on MSDN a How to set a Windows hook in Visual C # .NET , but I could not get it to work.

How can I listen to these events from my C # application or any suggestions on using other methods to get the current song and WMP play status?

thanks

+6
source share
2 answers

This article describes how to get events using AxWindowsMediaPlayer , which is the main root of the Windows media player system. You will see that various status change events can be raised normally.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd562388(v=vs.85).aspx

You should be able to run an executable instance from the ROT window (table of running objects)?

http://www.darinhiggins.com/the-running-instance-of-windows-media-player/

Edit:

This is another way ...

http://www.darinhiggins.com/gaining-access-to-a-running-instance-of-windows-media-player-in-vb-net/

+3
source

Source: https://habr.com/ru/post/924914/


All Articles