Solved

SendMessage() doesn't work from DLL and service

Posted on 1998-06-04
5
173 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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