PDA

View Full Version : سوال: مشکل با RegisterServiceProcess



saeedvir
پنج شنبه 20 اسفند 1388, 16:53 عصر
دوستان بعد از اینکه سورس زیر را اجرا می کنم این error داده میشه !

چه طور این مشکل را حل کنم ؟؟؟



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
'Right now, you're program is hidden from the CTRL-ALT-DEL-list
End Sub

Private Sub Form_Unload(Cancel As Integer)
UnMakeMeService
End Sub


http://forum.persiancoder.com//attachment.php?attachmentid=246&stc=1&d=1268308610