Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SendMessage() doesn't work from DLL and service

Posted on 1998-06-04
5
Medium Priority
?
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 800 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

660 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