Link to home
Start Free TrialLog in
Avatar of bandi081497
bandi081497

asked on

SendMessage() doesn't work from DLL and service

Hi All,

I want to send a message to my app when some event happened
in the service. The problem is that SendMessage doesn't work.
When I try to send message from another app to my app it worked.

Has anybody any guess?

Thanks in advance

Andras
Avatar of d003303
d003303

Yo,
is your service allowed to interact with the desktop ? If not, it resists on a seperate, invisible window station where the window handle you are using is invalid.

Slash/d003303
Avatar of bandi081497

ASKER

How can I set that? I mean the service would be allowed to intereact with the desktop?
Anyway, I've tried to send message from a DLL which is called
from service. I think that could be the problem, doesn't it?

Andras
Yes, the DLL is running in the same process environment as the service. To allow interaction with the desktop, proceeed as follows:
In Control Panel, open Services. Select your service in the listbox and click on Startup. Select Allow Service To Interact With Desktop there.

Slash/d003303
Thanks the right solution. I've tried and it worked.
But can you help me how can I set this
 
Allow Service To Interact With Desktop

from software when the service is being installed?

Thanks in advance

Andras
ASKER CERTIFIED SOLUTION
Avatar of d003303
d003303

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