Link to home
Start Free TrialLog in
Avatar of meirchen
meirchen

asked on

Using postmessage to post a message to another user?

Hi all,

I have the following problem:  Inside a service I want to post a registered windows message to all desktop windows.  Now, that is no problem, everything works.  But only if the service starts up as the system user.  When I want to send a message to user A (that is logged in) with the service that is started as user B.  Then the message is send but not received by the application of user A.

I was wondering if anybody can help me, I have used BroadcastMessage and Postmessage, but I don't find any correct parameter I can pass.

Thanx in advance
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jhance
jhance

Avatar of meirchen

ASKER

Sorry about the open questions, I have totally forgotten about them, Won't do it again. sorry
>>Won't do it again. sorry

Are you sort of forgetting about this one?
The best way to do what you're talking about would probably be to use DDE.  Also, if you're looking to broadcast, you can broadcast with postmessage by specifying the hwnd as -1.  Hope this helps.

Good luck!
>>The best way to do what you're talking about would probably be to use DDE

DDE from a service seems even more complicated to me....

BTW, as the main reason for not being able to send messages to user windows is that you simply do not have access to the desktop, allowing the service to "interact with the desktop" (can be done from the control panel applet or by setting "SERVICE_INTERACTIVE_PROCESS" when calling "CreateService()") might already help...
Thanx for the information

I have tried the solution of jkr, but for the moment I don't find the correct way, I have succeeded in logging on with another username in my program (as interactive) but I haven't received any messages on my desktop programs.  I still have to try it with other parameters and so, and I hope to have a possible solution tomorrow.

I don't know DDE, but I will look in to it.

Starting the service as System user is not possible, since the service needs to connect to other computers on the network.  And If I use '\\ComputerName\Sharename' he doesn't find the path.  I think it is because the system user is user only for the local PC, and not for a network.

If anyone has another idea, I'll be happy to receive it.
Try the method I described in my first post - it sure is more compilcated, but also more reliable.
The Q is answered
Thank you for responding! :o)