在控制台的属性页中加入参数好像重启服务时就没有了。我想带进去如数据库用户密码,循环间隔时间等等,怎么办?谢谢!

解决方案 »

  1.   

    注册service得时候,在pPath 后面附加参数 “c:\mysvr.exe -a -b”
    SC_HANDLE schService = CreateService

    schSCManager, /* SCManager database      */ 
    pName, /* name of service         */ 
    pName, /* service name to display */ 
    SERVICE_ALL_ACCESS,        /* desired access          */ 
    SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS , /* service type            */ 
    SERVICE_AUTO_START,      /* start type              */ 
    SERVICE_ERROR_NORMAL,      /* error control type      */ 
    pPath, /* service's binary        */ 
    NULL,                      /* no load ordering group  */ 
    NULL,                      /* no tag identifier       */ 
    NULL,                      /* no dependencies         */ 
    NULL,                      /* LocalSystem account     */ 
    NULL
    );