Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a program as a "Service" 1

Status
Not open for further replies.

GDX

Programmer
Jun 4, 2000
186
US
Can someone please explain to me how i might go about making an application act as a service that can be started and stopped? Also how do i make an application support command lines?
Gordon R. Durgha
gd@vslink.net
 
Partial answer to question #1 (you will have to work out the minute details):
[tt]
Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long
[/tt]

Then use the following function in the form load event:[tt]
RetVal = RegisterServiceProcess(GetCurrentProcessId(), 1)[/tt]


Answer to question #2:

The command line values are returned in Command. Returns the VB command line parameters at design time and the EXE command line parameters at run time.

Good luck.

VCA.gif

Alt255@Vorpalcom.Intranets.com
 
Nick, yours was a much more comprehensive answer but I don't think srvany will work in a w9x environment.

In any case, my answer was pretty wimpy because, once the app is registered as a service, it's pretty hard to control except by using it's own UI.

Does anybody have a good solution for cross-platform issues?
VCA.gif

Alt255@Vorpalcom.Intranets.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top