呵呵~~~ ,我只会用VC做,转行学VC吧~~

解决方案 »

  1.   

    那你只好在vb中狂调win32 api
      

  2.   

    给你几个API;SC_HANDLE OpenSCManager(
      LPCTSTR lpMachineName,  // pointer to machine name string
      LPCTSTR lpDatabaseName,  // pointer to database name string
      DWORD dwDesiredAccess   // type of access
    );
     
    SC_HANDLE CreateService(
      SC_HANDLE hSCManager,  // handle to service control manager 
                             // database
      LPCTSTR lpServiceName, // pointer to name of service to start
      LPCTSTR lpDisplayName, // pointer to display name
      DWORD dwDesiredAccess, // type of access to service
      DWORD dwServiceType,   // type of service
      DWORD dwStartType,     // when to start service
      DWORD dwErrorControl,  // severity if service fails to start
      LPCTSTR lpBinaryPathName,  // pointer to name of binary file
      LPCTSTR lpLoadOrderGroup,  // pointer to name of load ordering 
                                 // group
      LPDWORD lpdwTagId,     // pointer to variable to get tag identifier
      LPCTSTR lpDependencies,  // pointer to array of dependency names
      LPCTSTR lpServiceStartName,
                               // pointer to account name of service
      LPCTSTR lpPassword       // pointer to password for service account
    );
     SC_HANDLE OpenService(
      SC_HANDLE hSCManager,  // handle to service control manager 
                             // database
      LPCTSTR lpServiceName, // pointer to name of service to start
      DWORD dwDesiredAccess  // type of access to service
    ); BOOL DeleteService(
      SC_HANDLE hService   // handle to service
    );
     BOOL StartServiceCtrlDispatcher(
      LPSERVICE_TABLE_ENTRY lpServiceStartTable   // address of service 
                                                  // table
    );
     BOOL SetServiceStatus(
      SERVICE_STATUS_HANDLE hServiceStatus~,
                                         // service status handle
      LPSERVICE_STATUS lpServiceStatus   // address of status structure
    );
      

  3.   

    wjf   能更详细点吗?
    发邮件给我,OK?
      

  4.   

    jing , pleae give me a copy 
    "[email protected]"
    thanks !
      

  5.   

    发给我!
    Email:[email protected]
      

  6.   

    其实以上的论断都不对,我就作过VB的NT服务,还作过只用模块生成C的窗口类型,其实在VB中写服务的关键不在于技术,你如果单纯认为将C的代码改为VB的代码的话,那你就错了。
    我这里有你需要的真正的VB/NT服务程序,及编写需要的利器,如需:EMAIL:[email protected],用了以后,不要不给分!!!
      

  7.   

    rosement 我给你发了,怎么没回音?
      

  8.   

    look at codeguru
    there is a famouse wizard for
    create a nt service project.
    good lucky.
    jansen zhu.
      

  9.   

    use
    srvinstw.exe -- install a application as a service programsrvany.exe   -- encapsulate application to a service programYou'd better don't use VB write service, MS don't support that!These utility could be found from NT resource kit.
      

  10.   

    为了回答这个问题,我已经给一些网友发了必要的ACTIVEX,这里给大家一个例子:
    Sub Main()
    Load Form1
        Dim strDisplayName As StringOn Error GoTo Err_Load    strDisplayName = Form1.NTService1.DisplayName
        
        If Command = "-install" Then
            ' Enable interaction with desktop.
            Form1.NTService1.Interactive = True
            
            If Form1.NTService1.Install Then
    MsgBox strDisplayName & " installed successfully"
            Else
                MsgBox strDisplayName & " failed to install"
            End If
            End
        
        ElseIf Command = "-uninstall" Then
            If Form1.NTService1.Uninstall Then
                MsgBox strDisplayName & " uninstalled successfully"
            Else
                MsgBox strDisplayName & " failed to uninstall"
            End If
            End
        
        ElseIf Command = "-debug" Then
            Form1.NTService1.Debug = True
        
        ElseIf Command <> "" Then
            MsgBox "Invalid command option"
            End
        
        End If
        
        ' Connect service to Windows NT services controller.
        Form1.NTService1.StartService
        
    Err_Load:
        ' Error starting service
    End SubPrivate Sub NTService1_Start(Success As Boolean)
    On Error GoTo Err_Start    ' TODO: Begin processing    Success = True       ' Report successErr_Start:
        Call NTService1.LogEvent(svcMessageError, svcEventError, "[" & _
             Err.Number & "] " & Err.Description)End Sub
    Private Sub NTService1_Start(Success As Boolean)
    On Error GoTo Err_Start    ' TODO: Begin processing    Success = True       ' Report successErr_Start:
        Call NTService1.LogEvent(svcMessageError, svcEventError, "[" & _
             Err.Number & "] " & Err.Description)End Sub
    希望以上的例子对大家有用:
    注意运行时:***.exe -install :装入服务程序(运行后打开你的控制面板,查看服务,发现了什么??!!!)
               ***.exe -install :卸载服务程序
      

  11.   

    rosement的解答大家可以在以下地址找到:
    Http://msdn.microsoft.com/library/techart/msdn_ntsrvocx.htm