🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages Started by Andrew Fedoseev Sun, 04 Nov 2007 10:32
TServiceApplication and Windows 2003
#1017
Author: Andrew Fedoseev
Date: Sun, 04 Nov 2007 10:32
38 lines
2309 bytes
Hi there!

Here's the excerpt of what you get when you start to write such an 
aplication:

 // Windows 2003 Server requires StartServiceCtrlDispatcher to be
  // called before CoRegisterClassObject, which can be called indirectly
  // by Application.Initialize. TServiceApplication->DelayInitialize allows
  // Application->Initialize to be called from TService->Main (after
  // StartServiceCtrlDispatcher has been called).
  //
  // Delayed initialization of the Application object may affect
  // events which then occur prior to initialization, such as
  // TService->OnCreate. It is only recommended if the ServiceApplication
  // registers a class object with OLE and is intended for use with
  // Windows 2003 Server.
  //
  // Application->DelayInitialize = true;
  //

 Unfortunately, my service aplication is designated to work under Windows 
2003 OS. So, if a inderstood right i should
put this code below into TService OnCreate method:
......
  SERVICE_TABLE_ENTRY   DispatchTable[1];
  DispatchTable[0].lpServiceName = this->DisplayName.c_str();
  DispatchTable[0].lpServiceProc = this->Main; 
//<-and surely, i get an compiler error messagehere

 StartServiceCtrlDispatcher(DispatchTable);
......


How do i get this working? How do i connect DispatchTable[0].lpServiceProc 
to whatever TService class has?

Thanks in advance,
Andrew.
Re: TServiceApplication and Windows 2003
#1018
Author: Andrew Fedoseev
Date: Sun, 04 Nov 2007 11:41
55 lines
2928 bytes
"Andrew Fedoseev" <andrewxf@gmail.com> �������/�������� � �������� 
���������: news:472da042$1@newsgroups.borland.com...
> Hi there!
>
> Here's the excerpt of what you get when you start to write such an 
> aplication:
>
> // Windows 2003 Server requires StartServiceCtrlDispatcher to be
>  // called before CoRegisterClassObject, which can be called indirectly
>  // by Application.Initialize. TServiceApplication->DelayInitialize allows
>  // Application->Initialize to be called from TService->Main (after
>  // StartServiceCtrlDispatcher has been called).
>  //
>  // Delayed initialization of the Application object may affect
>  // events which then occur prior to initialization, such as
>  // TService->OnCreate. It is only recommended if the ServiceApplication
>  // registers a class object with OLE and is intended for use with
>  // Windows 2003 Server.
>  //
>  // Application->DelayInitialize = true;
>  //
>
> Unfortunately, my service aplication is designated to work under Windows 
> 2003 OS. So, if a inderstood right i should
> put this code below into TService OnCreate method:
> ......
>  SERVICE_TABLE_ENTRY   DispatchTable[1];
>  DispatchTable[0].lpServiceName = this->DisplayName.c_str();
>  DispatchTable[0].lpServiceProc = this->Main; //<-and surely, i get an 
> compiler error messagehere

Sorry, should be looking like this:

SERVICE_TABLE_ENTRY   DispatchTable[2];
  DispatchTable[0].lpServiceName = this->DisplayName.c_str();
  DispatchTable[0].lpServiceProc = this->Main;
  DispatchTable[1].lpServiceName = NULL
  DispatchTable[2].lpServiceProc = NULL;

Nevertheless, it still  doesnt change anything.

> StartServiceCtrlDispatcher(DispatchTable);
> ......
>
>
> How do i get this working? How do i connect DispatchTable[0].lpServiceProc 
> to whatever TService class has?
>
> Thanks in advance,
> Andrew.
>
>
>
> 
Re: TServiceApplication and Windows 2003
#1019
Author: Andrew Fedoseev
Date: Sun, 04 Nov 2007 15:19
45 lines
2503 bytes
solved
"Andrew Fedoseev" <andrewxf@gmail.com> �������/�������� � �������� 
���������: news:472da042$1@newsgroups.borland.com...
> Hi there!
>
> Here's the excerpt of what you get when you start to write such an 
> aplication:
>
> // Windows 2003 Server requires StartServiceCtrlDispatcher to be
>  // called before CoRegisterClassObject, which can be called indirectly
>  // by Application.Initialize. TServiceApplication->DelayInitialize allows
>  // Application->Initialize to be called from TService->Main (after
>  // StartServiceCtrlDispatcher has been called).
>  //
>  // Delayed initialization of the Application object may affect
>  // events which then occur prior to initialization, such as
>  // TService->OnCreate. It is only recommended if the ServiceApplication
>  // registers a class object with OLE and is intended for use with
>  // Windows 2003 Server.
>  //
>  // Application->DelayInitialize = true;
>  //
>
> Unfortunately, my service aplication is designated to work under Windows 
> 2003 OS. So, if a inderstood right i should
> put this code below into TService OnCreate method:
> ......
>  SERVICE_TABLE_ENTRY   DispatchTable[1];
>  DispatchTable[0].lpServiceName = this->DisplayName.c_str();
>  DispatchTable[0].lpServiceProc = this->Main; //<-and surely, i get an 
> compiler error messagehere
>
> StartServiceCtrlDispatcher(DispatchTable);
> ......
>
>
> How do i get this working? How do i connect DispatchTable[0].lpServiceProc 
> to whatever TService class has?
>
> Thanks in advance,
> Andrew.
>
>
>
> 
Re: TServiceApplication and Windows 2003
#1025
Author: Remy Lebeau (TeamB)
Date: Mon, 05 Nov 2007 06:13
27 lines
1579 bytes
"Andrew Fedoseev" <andrewxf@gmail.com> wrote in message
news:472da042$1@newsgroups.borland.com...

> Here's the excerpt of what you get when you start to write such an
> aplication:

That comment only applies if your service hosts a COM object in it.  If it
does not, then ignore the comment completely.

> if a inderstood right

Sorry, you do not.

> i should put this code below into TService OnCreate method:

No, you should not.  The comment is telling you to uncomment the assignment
of the Application->DelayInitialize property, but only if your service hosts
a COM object in it.

> How do i get this working?

Leave it alone.  TService already works in Windows 2003 without you doing
anything extra for it.


Gambit
Re: TServiceApplication and Windows 2003
#1026
Author: Andrew Fedoseev
Date: Mon, 05 Nov 2007 07:33
36 lines
2096 bytes
I had already worked it out by the time you answered, but thanks anyway!


"Remy Lebeau (TeamB)" <no.spam@no.spam.com> �������/�������� � �������� 
���������: news:472ea679$1@newsgroups.borland.com...
>
> "Andrew Fedoseev" <andrewxf@gmail.com> wrote in message
> news:472da042$1@newsgroups.borland.com...
>
>> Here's the excerpt of what you get when you start to write such an
>> aplication:
>
> That comment only applies if your service hosts a COM object in it.  If it
> does not, then ignore the comment completely.
>
>> if a inderstood right
>
> Sorry, you do not.
>
>> i should put this code below into TService OnCreate method:
>
> No, you should not.  The comment is telling you to uncomment the 
> assignment
> of the Application->DelayInitialize property, but only if your service 
> hosts
> a COM object in it.
>
>> How do i get this working?
>
> Leave it alone.  TService already works in Windows 2003 without you doing
> anything extra for it.
>
>
> Gambit
>
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads