Results 1 to 9 of 9

Thread: Service Register

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    8

    Question

    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?

  2. #2
    Addicted Member
    Join Date
    Mar 2000
    Location
    Gainesville, FL
    Posts
    131
    Please show us your declaration, your Visual Basic number, and the operating system you're using.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    8
    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.



  4. #4

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    8
    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

  5. #5
    Addicted Member
    Join Date
    Mar 2000
    Location
    Gainesville, FL
    Posts
    131
    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.


  6. #6

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    8

    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


  7. #7
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    363
    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]
    Wade

  8. #8
    Addicted Member
    Join Date
    Jul 1999
    Location
    St-Élie d'Orford, Quebec, Canada
    Posts
    133
    try this link my friend...
    http://vb.duke.net/howto/service.html

  9. #9

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    8
    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
  •  



Click Here to Expand Forum to Full Width