Solved

SendMessage to service application (delphi  7)

Posted on 2009-05-05
4
2,089 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
You are both wrong. FindWindow works well in services unless you know the class name.
I fixed it.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

12 Experts available now in Live!

Get 1:1 Help Now