BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Communicating between a Service and a regular Window program

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Compatibility with MFC)
View previous topic :: View next topic  
Author Message
Ron
Guest





PostPosted: Wed Nov 22, 2006 9:40 pm    Post subject: Communicating between a Service and a regular Window program Reply with quote



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





PostPosted: Thu Nov 23, 2006 12:14 am    Post subject: Re: Communicating between a Service and a regular Window pro Reply with quote



"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





PostPosted: Fri Nov 24, 2006 10:43 pm    Post subject: Re: Communicating between a Service and a regular Window pro Reply with quote



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





PostPosted: Sat Nov 25, 2006 7:50 am    Post subject: Re: Communicating between a Service and a regular Window pro Reply with quote

"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





PostPosted: Tue Nov 28, 2006 4:55 am    Post subject: Re: Communicating between a Service and a regular Window pro Reply with quote

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





PostPosted: Tue Nov 28, 2006 5:36 am    Post subject: Re: Communicating between a Service and a regular Window pro Reply with quote

"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Compatibility with MFC) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.