-
I am trying to register my program as a service, so I used the sample code that is supplied by this site to do that (http://www.vb-world.net/tips/tip135.html)
I get this error when I run my program using this code:
run-time error '451':
Can't find DLL entry point RegisterServiceProcess in kernel32
So I looked at the comments, and someone else had this same problem, and the response to this was:
Try Looking in the Win32 API instead of the Kernal API.
But how do I do that?
-
Please show us your declaration, your Visual Basic number, and the operating system you're using.
-
Im using windows 2000
this is the code in the module that I'm using:
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
Public Sub MakeMeService()
Dim pid As Long
Dim reserv As Long
pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
End Sub
This is exactly the code from the tutorial. Maybe some of it isn't supposed to go in a module, but in the actual code.
I'm calling 'MakeMeService' from 'form_load'
so it should make it a service as soon as it starts.
-
oh yeah....
VB: Visual Basic 6.0 Enterprise
O/S: Microsoft Windows 2000 SE w/latest patches
SYS: Intel Pentium III 600MHz, 128MB RAM, 8GB HD
I don't think any of the other stuff should be revelant to whether or not it gets registered as a service
-
The code you're using is designed for Win 9x.
You'll have to find different code that works for Win2k.
Go to my site, and download my KeyLogger. See if it runs on your system. It's not supposed to show itself in the task list. If the program crashes with the same error that you're getting when you try and do it, then we know it's Win2k.
-
win nt4
Actually I'm writing the code to be a service on aa win nt4 machine.... If you know where I can get the code for a win nt service, please tell me
-
The Kernel32.dll is on NT, but doesn't have the RegisterServiceProcess API -- according to MSDN, it was designed specifically for 95/98.
[Edited by WadeD on 06-01-2000 at 10:58 AM]
-
-
hey thanks a lot, this is exactly what i needed :)