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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
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
TimCotteeHead of Software ServicesCommented:
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
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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
TimCotteeHead of Software ServicesCommented:
What more do you need / want ?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.