Squeak as an NT service

Torsten.Bergmann at phaidros.com Torsten.Bergmann at phaidros.com
Mon Jan 29 08:46:53 UTC 2001


Hi Andreas,

I once wrote an NT Service sample which allows you to easily create a
windows service 
in Smalltalk. It is included in the Smalltalk MT distribution. You can check
out their 
test version (www.objectconnect.com or www.genify.com) to see how it's done
or try the 
following:

Anything you have to do is to set the appropriate startup (dwStartupType)
type when 
you call the CreateService()-API. SERVICE_AUTO_START will specify a service
who will
be started automatically by the service control manager during system
startup.

My SmalltalkMT Service also initializes the service state like the
following:

	WinNTService>>initialize
		...
		status := SERVICE_STATUS new.  "service state structure"
		status dwServiceType: SERVICE_WIN32_OWN_PROCESS; "this
service only contains the code for one service"
		       dwCurrentState: SERVICE_STOPPED;
		       dwControlsAccepted:
SERVICE_ACCEPT_STOP|SERVICE_ACCEPT_SHUTDOWN; "the service accepts
start/stop"
		       dwWin32ExitCode: 0;
		       dwServiceSpecificExitCode: 0;
		       dwCheckPoint: 0;
		       dwWaitHint: 0.
		self status: status;	"set state and update using
SetServiceStatus()-API"
		     isRunning: false. 


SERVICE_ACCEPT_SHUTDOWN means: The service is notified when system shutdown
occurs. This flag allows the service 
to receive the SERVICE_CONTROL_SHUTDOWN value. Note that ControlService
cannot send this control code; only the 
system can send SERVICE_CONTROL_SHUTDOWN.

Check out the following pages in the MSDN or search for one of the flags/api
functions in the library:
http://msdn.microsoft.com/library/psdk/winbase/services_3p9h.htm
http://msdn.microsoft.com/library/psdk/winbase/services_9s36.htm


Hope this helps
Torsten




-----Original Message-----
From: Raab, Andreas [mailto:Andreas.Raab at disney.com]
Sent: Samstag, 27. Januar 2001 20:38
To: 'squeak at cs.uiuc.edu'
Subject: RE: Squeak as an NT service


Peter,

It may certainly be useful, but the fact of the matter is that I have no
idea of how to make it happen :-( Any Windows hackers out there who can
help?!

  - Andreas





More information about the Squeak-dev mailing list