|
-
May 31st, 2000, 01:24 AM
#1
Thread Starter
New Member
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?
-
May 31st, 2000, 01:34 AM
#2
Addicted Member
Please show us your declaration, your Visual Basic number, and the operating system you're using.
-
May 31st, 2000, 01:59 AM
#3
Thread Starter
New Member
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.
-
May 31st, 2000, 02:03 AM
#4
Thread Starter
New Member
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
-
May 31st, 2000, 03:11 AM
#5
Addicted Member
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.
-
May 31st, 2000, 09:07 PM
#6
Thread Starter
New Member
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
-
May 31st, 2000, 09:55 PM
#7
Hyperactive Member
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]
-
Jun 1st, 2000, 02:15 AM
#8
Addicted Member
-
Jun 1st, 2000, 04:07 AM
#9
Thread Starter
New Member
hey thanks a lot, this is exactly what i needed
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|