示例#1
0
  /** Initialize the service, connect to the ServiceControlManager. */
  public void init() {
    Advapi32 advapi32;
    SERVICE_TABLE_ENTRY entry;

    serviceMain = new ServiceMain();
    advapi32 = Advapi32.INSTANCE;
    entry = new Advapi32.SERVICE_TABLE_ENTRY();
    entry.lpServiceName = serviceName;
    entry.lpServiceProc = serviceMain;

    advapi32.StartServiceCtrlDispatcher((SERVICE_TABLE_ENTRY[]) entry.toArray(2));
  }