Solved

SendMessage to service application (delphi  7)

Posted on 2009-05-05
4
2,113 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best Firemonkey component pack 1 85
Printing problem 2 79
Mobile Keyboard covers the display of the TMemo 3 78
TServerSocket - file via sendbuf or Text via sendtext ? 1 42
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…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

948 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

21 Experts available now in Live!

Get 1:1 Help Now