| View previous topic :: View next topic |
| Author |
Message |
Ron Guest
|
Posted: Wed Nov 22, 2006 9:40 pm Post subject: Communicating between a Service and a regular Window program |
|
|
Is there anyway to post a message from a service to a regular
windows application? How about a broadcast message?
unsigned long MyDisconnectMessage = RegisterWindowMessage("test message");
::SendMessage(HWND_BROADCAST, MyDisconnectMessage, 0, 0);
This does not seem to work. I am guessing because it comes from a service. Is there anyone to do what I'm trying to do? |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Nov 23, 2006 12:14 am Post subject: Re: Communicating between a Service and a regular Window pro |
|
|
"Ron" <win8128 (AT) aol (DOT) com> wrote in message
news:45647d62$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Is there anyway to post a message from a service to a
regular windows application?
|
Not reliably. If the service is not running in the same workstation/desktop
as the application, then you cannot use window messages at all, as they
cannot pass over desktop boundaries.
You would be better off using named pipes or TCP/IP sockets instead.
Gambit |
|
| Back to top |
|
 |
Ron Sawyer Guest
|
Posted: Fri Nov 24, 2006 10:43 pm Post subject: Re: Communicating between a Service and a regular Window pro |
|
|
Thanks! It would have to span desktop boundaries. I originally was using
TCP/IP, but my original design was poor and I was overloading the processor.
(I was polling the the service and believe now that I will have to do a push
from the service rather than a pull.) A post message would have been really
easy, but I think I have it worked out in my head how I want to do what
needs to be done.
Thanks for the response (as always you are a fount of information) and happy
Holidays. |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sat Nov 25, 2006 7:50 am Post subject: Re: Communicating between a Service and a regular Window pro |
|
|
"Ron Sawyer" <XXXRSAWYER8128XQQXX (AT) aol (DOT) com> wrote in message
news:4567212f$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Thanks! It would have to span desktop boundaries.
|
Then you cannot use window messages for your communication.
| Quote: | I originally was using TCP/IP, but my original design was poor and
I was overloading the processor. I was polling the the service
|
What exactly were you polling?
| Quote: | believe now that I will have to do a push from the service rather than a
pull. |
That depends on how the client application is using the socket. If the
application is using a blocking socket, then the client will have to poll
the socket anyway. But polling a socket should not be pegging the CPU usage
in either case, unless you were polling way too often, and not using
efficient waiting methods.
Gambit |
|
| Back to top |
|
 |
Ron Sawyer Guest
|
Posted: Tue Nov 28, 2006 4:55 am Post subject: Re: Communicating between a Service and a regular Window pro |
|
|
The better method is the push - which is working now. The reason I didn't
originally use it was because I couldn't see how to use the specific Socket
VCL that I was using in non-blocking mode. I am now using a different VCL
which allows for non-blocking and everything is moving smoothly. |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Nov 28, 2006 5:36 am Post subject: Re: Communicating between a Service and a regular Window pro |
|
|
"Ron Sawyer" <XXXRSAWYER8128XQQXX (AT) aol (DOT) com> wrote in message
news:456b6ccf$1 (AT) newsgroups (DOT) borland.com...
| Quote: | I couldn't see how to use the specific Socket VCL that I was using
in non-blocking mode.
|
What were you having a problem with?
Gambit |
|
| Back to top |
|
 |
|