Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 16th, 2005, 6:24 AM   #1
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road
installing service

hey i want to try installin a program as a service but i want it to work on a few windows versions (not just NT) XP 2000 and NT ive seen a couple of programs out there that can install but only for nt >_<
does anyone know a program that can install a service (a program that doesnt have a gui, a command line instead )

or anyone know where i can find how to make one or any tips or if it would be to hard to make one seems as im a beginner

please help me
thanks alot
cloud- is offline   Reply With Quote
Old Feb 17th, 2005, 7:40 PM   #2
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
from MSDN:
Const RSP_SIMPLE_SERVICE = 1
Const RSP_UNREGISTER_SERVICE = 0
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Private Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
Public Sub MakeMeService()
    Dim pid As Long, reserv As Long
    'Get the current process ID
    pid = GetCurrentProcessId()
    'Register as service
    regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
End Sub
Public Sub UnMakeMeService()
    Dim pid As Long, reserv As Long
    'Get the current process ID
    pid = GetCurrentProcessId()
    'Unregister as service
    regserv = RegisterServiceProcess(pid, RSP_UNREGISTER_SERVICE)
End Sub
Private Sub Form_Load()
    MakeMeService
End Sub
Private Sub Form_Unload(Cancel As Integer)
    UnMakeMeService
End Sub
the above registers an already running thread as a simple service (basically moves it from the process list to the service list).
Will only work on versions of windows up to 2000 - not XP.
For a fully working service EXE (automatic startup, start stop buttons etc) you'll need to google.
Vb6 support for services in XP and on is defunct, as all services are now digitally signed and trusted etc. meaning you have to use VB.NET. Sorry!
Rory is offline   Reply With Quote
Old Feb 19th, 2005, 5:00 AM   #3
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road
thanks for the help again ^^
ill check google for some programs
cloud- is offline   Reply With Quote
Old Feb 19th, 2005, 3:07 PM   #4
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
No Problem!
If you can't find anything, you could always make your app sit in the system tray, if that's any help.
Rory is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:40 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC