🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1132

Re: Open a Form in a TServiceApplication during ServiceStart

#1132
From: Marc
Date: Thu, 25 Oct 2007 17:34
49 lines
2663 bytes
Hi Gambit



Mmmh... not the answer I expected, but thanks anyway.

I guess I tried to take a short cut and avoid having to have two 
applications and communicate through IPC.



Rds

Marc


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> schrieb im Newsbeitrag 
news:4720cb19$1@newsgroups.borland.com...
>
> "Marc" <info@mawnet.com> wrote in message 
> news:4720c4bf@newsgroups.borland.com...
>
>> Now I create a blank form and display [MyForm->Show()]
>> it in the ServiceStart event.
>
> DO NOT EVER display a UI from a service!!!  Services are background 
> processes.  They are not supposed to interact with the user directly, with 
> the exception of simply MessageBox() dialogs when notifications are 
> needed. In fact, UIs in services are strictly not allowed anymore starting 
> with Vista.  For a service to display a UI, the proper way to handle that 
> (in any OS version) is to create a separate non-service application that 
> runs after the user has logged in, and then have that application 
> communicate with the service as needed using any of a number of IPC 
> (inter-process communication) technologies that are available, such as 
> sockets or named pipes.
>
>> If I check with the debugger, it crashes when it tries to release my form 
>> at the end of the application.
>
> Another reason not to use UIs in services - TService is multi-threaded, 
> and the VCL's UI components are not thread-safe.
>
>> I have written services before that open Forms in the OnExecute loop.
>
> You should never have been doing that in the first place.
>
>
> Gambit
> 
Technical Details
Message-ID: <4720d3e8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!eweka.nl!lightspeed.eweka.nl!194.134.4.77.MISMATCH!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4720c4bf@newsgroups.borland.com> <4720cb19$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,8191050f071867e7
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Marc" <info@mawnet.com>
From: "Marc" <info@mawnet.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4720c4bf@newsgroups.borland.com> <4720cb19$1@newsgroups.borland.com>
Subject: Re: Open a Form in a TServiceApplication during ServiceStart 
Date: Thu, 25 Oct 2007 19:34:30 +0200
Lines: 51
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 83.76.62.142
Message-ID: <4720d3e8$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1193333736 83.76.62.142 (25 Oct 2007 10:35:36 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!eweka.nl!lightspeed.eweka.nl!194.134.4.77.MISMATCH!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail