Вопрос

How can i send a sendmessage & postmessage from nt service to an application which launched in a remote desktop session? currently i temporarily solved this problem via udp communications between applications.

Это было полезно?

Решение

You cannot send messages across session boundaries. So you need an IPC solution like TCP/IP, sockets, named pipes etc.

Другие советы

Make a program that does a sendmessage/postmessage:

program sendit; uses converters; begin exitcode:=sendmessage(covert1(paramstr(1)),convert2( .... etc end.

Then run it in the right session with CreateProcessAsUser. You can wait (WaitForSingleObject) for the program to exit, at which point the sendmessage completed. It's very slow though :).

You can also go with pipes/IPC, but you can still launch the "server" using CreateProcessAsUser. Use Jwa for getting tokens and such.

And use better names than I just did :).

Use the WTSSendMessage api: Displays a message box on the client desktop of a specified Remote Desktop Services session.

http://msdn.microsoft.com/nl-nl/library/windows/desktop/aa383842(v=vs.85).aspx

Or use the Jedi Windows Security library which wraps this in nice delphi like objects

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top