Solved

SendMessage to service application (delphi  7)

Posted on 2009-05-05
4
2,140 Views
Last Modified: 2012-06-27
how can I send a message using SendMessage to a service application? it looks like the FindWindow doesnt find any window.

I dont want to use TCP/IP communication. I just need a quick way to send a short message without arguments to the service.
0
Comment
Question by:WebWolf1
  • 2
4 Comments
 
LVL 18

Expert Comment

by:Johnjces
ID: 24307054
Have a look at this Q still up on EE.

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_24376994.html

There is a link, I think, for SimpleIPC which uses FindWindow (source is included) that might help you and the entuire thread might be of assistance. Her is some of my info.....

If you do not want to use TCP/IP you could use mailslots which are not like email.

I have used them (mailslots) and they work just great.

You could also use a components called TssSimpleIPC from SunnisSoft. This uses WIndows Messaging (added via FindWindow).

http://www.sunisoft.com
http://www.torry.net/vcl/system/appscommunications/simpleipc.zip

It works very well in services and applications and it is free. Not sure what version of Delphi so could take some tweaking in newer versions.

John
0
 
LVL 18

Expert Comment

by:Johnjces
ID: 24307093
Added...

I must add that I have never used FIndWindow to "talk" to a service. I am pretty certain that you cannot talk to a service from an application using findwindow since a service does not have a window to find.

From service to application seems to work great for me and I had no problems in Vista either.

You will have to use a mailslot component. Look on torry or delphipages for mailslots.

John
0
 
LVL 12

Expert Comment

by:Hypo
ID: 24333464
If you for some reason can't send Windows messages to the service (like if the service don't have a window handle), then you could have your service create a named pipe, to which your other applications then can connect to and send messages. (I think this is quite a common way to communicate with services).
Rlibby (who is an expert in this forum), has created and published a vary good unit that can help you with pipe communication. To download, goto http://home.roadrunner.com/~rllibby/source.html, and get the file pipes.zip.

regards
Hypo
0
 

Accepted Solution

by:
WebWolf1 earned 0 total points
ID: 24365137
You are both wrong. FindWindow works well in services unless you know the class name.
I fixed it.
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 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