Solved

SendMessage() doesn't work from DLL and service

Posted on 1998-06-04
5
168 Views
Last Modified: 2010-04-03
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
0
Comment
Question by:bandi081497
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:d003303
ID: 1350270
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
0
 

Author Comment

by:bandi081497
ID: 1350271
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
0
 
LVL 4

Expert Comment

by:d003303
ID: 1350272
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
0
 

Author Comment

by:bandi081497
ID: 1350273
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
0
 
LVL 4

Accepted Solution

by:
d003303 earned 200 total points
ID: 1350274
Yo,
use the CreateService API call. Set the dwServiceType parameter to
(SERVICE_WIN32_OWN_PROCESS or SERVICE_INTERACTIVE_PROCESS)

Slash/d003303
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now