Is there any tool to send (mimic) a windows message like \'WM_ENDSESSION\' to a windows service?
OR
How can I send a windows message to a process using C#?
If you have the hwnd of a window you can send it messages. The only limitation is that you can't send messages that contain pointers like setting window text.
Simply call PostMessage()
with the value of the hwnd and the message you want to send.
To find the hwnd you can use spy++.
I'm not sure how you connect all this to windows services since windows services don't have windows.