Article View: borland.public.cppbuilder.nativeapi
Article #14062Re: Messaging a TService
From: BlackFrancis
Date: Mon, 25 Aug 2003 11:08
Date: Mon, 25 Aug 2003 11:08
43 lines
2681 bytes
2681 bytes
"Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message news:3f47d014@newsgroups.borland.com... > > "BlackFrancis" <areyouabot@toobad.com> wrote in message > news:3f46e02e$1@newsgroups.borland.com... > > > I have been able to send messages (using SendMessage) and > > recieve them by overriding WndProc. My problem is now that I > > want to send a message to a TService. > > Services do not accept messages like you are thinking. > > > TServices aren't allowed to have Controls > > That's not entirely accurate, but it takes a lot of work to set it up > correctly, so it is best to not put controls in services directly. > > > Is there any way around this, or will I have to try > > an alternative messaging methodology? > > You will have to set up and establish a different kind of IPC (inter-process > communication) connection to the service. Depending on the nature of your > messages, if they do not have any parameters, then you can use > ControlService() to send custom control codes to the service. TService has > a protected DoCustomControl() method that you can override for processing > them. Otherwise, you will need to use named pipes, TCP sockets, RPC (Remote > Procedure Call), COM, etc instead. > > > Gambit > > > Thanks for that. I have now been able to write ControlService code that makes a call to the Service, using an SCManager handle. What I don't have is the message handling routines in my TService. Could you briefly explain (possibly with sample code) how this is done? Thanks again
Technical Details
Message-ID:
<3f49ee2e$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!ngpeer.news.aol.com!newsfeed1!bredband!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f46e02e$1@newsgroups.borland.com> <3f47d014@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,161ad0877257a485 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-25 04:09:45 PST Reply-To: "BlackFrancis" <areyouabot@toobad.com> From: "BlackFrancis" <areyouabot@toobad.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f46e02e$1@newsgroups.borland.com> <3f47d014@newsgroups.borland.com> Subject: Re: Messaging a TService Date: Mon, 25 Aug 2003 21:08:49 +1000 Lines: 45 Organization: Thievery Inc X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 203.113.244.226 Message-ID: <3f49ee2e$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1061809710 203.113.244.226 (25 Aug 2003 04:08:30 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!ngpeer.news.aol.com!newsfeed1!bredband!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail