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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run App as Service using Kernel32 instead of SRVANY

Status
Not open for further replies.

adale

Programmer
Apr 18, 2001
48
GB
Is there a NT version equivalent of this code that runs in Win95 and hides applications from the task manager ?
And will it make applications run regardless of whether a user is logged in or not. I would rather use code instead of the SRVANY.EXE.

Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Private Declare Function RegisterServiceProcess Lib "kernel32" (ByVal dwProcessID As Long, ByVal dwType As Long) As Long

Sub Form_Load()
' Hide the application from
' the task manager (Ctrl+Alt+Del)
HideTask True
End Sub

Public Sub HideTask(Hide As Boolean)
Dim lHandle As Long
Dim lService As Long
' If Hide = True, register as a service
lHandle = GetCurrentProcessId()
lService = RegisterServiceProcess(lHandle, Abs(Hide))
End Sub
 
I couldn't get it to work in NT, not that I tried that hard, it's just that the error message was disheartening. So I looked for some other references to the problem and found an excellent sample programme that I could ravage. It is working (fingers crossed) very smoothly.

[]

Unfortunately I couldn't retract my email request.
Thankyou very much for answering, and have a good weekend.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top