Windows NT 4 service from a VB program

How to make a VB program exe file to run as a Windows NT 4 service?
My program uses odbc connections to work against several SQL Server 7 databases.
If not from VB, can it be done using C++ ?

LVL 3
mordiAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
TimCotteeConnect With a Mentor Commented:
What more do you need / want ?
0
 
TimCotteeCommented:
You can use INSTSRV to set an application to run as an NT service. However if it is running in the local system account it will not normally have access to the network. This can be overcome either by setting the service to run as another account, or there is a registry setting (details are available on technet) to allow the local system account to use named pipes and / or network access. If you use a different account name then the system can have EITHER network access OR a user interface but not both.
0
 
mordiAuthor Commented:
TimCotte,

How can I use INSTSRV .
Can you explain more in deep what do you mean?

Thanks
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
TimCotteeCommented:
INSTSRV is a utility provided with the Windows NT resource kit. There is also a word document accompanying the reskit which details how to go about running an application as a service on NT and also the relevant bits on the network access etc. I can EMail these to you if you post your address or EMail me at TimCottee@Earthling.net and I will send them back.
0
 
jetforceCommented:
try this web site

http://vbwire.com/advanced/howto/

it tells you how to create a service on W95/98 and NT

hope this helps
0
 
jjmartinCommented:
To do this, your must register your program as a service. This is done by passing the process ID of your application to the RegisterService API.

Declarations
Copy the following code into the declarations section of a module:

Public Declare Function GetCurrentProcessId _
Lib "kernel32" () As Long
Public Declare Function GetCurrentProcess _
Lib "kernel32" () As Long
Public Declare Function RegisterServiceProcess _
Lib "kernel32" (ByVal dwProcessID As Long, _
ByVal dwType As Long) As Long
Public Const RSP_SIMPLE_SERVICE = 1
Public Const RSP_UNREGISTER_SERVICE = 0

MakeMeService procedure:

Public Sub MakeMeService()
Dim pid As Long
Dim reserv As Long

pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
End Sub
To restore your application to the Ctrl+Alt+Delete list, call the UnMakeMeService procedure:

Public UnMakeMeService()
Dim pid As Long
Dim reserv As Long

pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, _
RSP_UNREGISTER_SERVICE)
'End Code
Don''t forget to unregister your application as a service before it closes to free up system resources by calling UnMakeMeService.

0
 
mordiAuthor Commented:
Thank you all, but i can't give you points for this .
0
All Courses

From novice to tech pro — start learning today.