易语言编写系统服务通用框架源码

.版本 2 .程序集 程序集1 .程序集变量 hStatus, 整数型 .程序集变量 ServiceStatus, SERVICE_STATUS .程序集变量 ServerName, 文本型 .子程序 _启动子程序, 整数型, , 本子程序在程序启动后最先执行 .局部变量 ste, SERVICE_TABLE_ENTRY, , "2" ServerName = “hahaha” ste [1].lpServiceName = ServerName ste [1].lpServiceProc = 到整数 (&ServiceMain) StartServiceCtrlDispatcher (ste) 返回 (0) ' 可以根据您的需要返回任意数值 .子程序 ServiceMain hStatus = RegisterServiceCtrlHandler (ServerName, 到整数 (&Handler)) ServiceStatus.dwServiceType = #SERVICE_WIN32_OWN_PROCESS ServiceStatus.dwCurrentState = #SERVICE_START_PENDING ServiceStatus.dwControlsAccepted = 位或 (#SERVICE_ACCEPT_STOP, #SERVICE_ACCEPT_SHUTDOWN) ServiceStatus.dwWin32ExitCode = 0 ServiceStatus.dwServiceSpecificExitCode = 0 ServiceStatus.dwCheckPoint = 0 ServiceStatus.dwWaitHint = 0 ServiceStatus.dwCurrentState = #SERVICE_RUNNING SetServiceStatus (hStatus, ServiceStatus) ' 执行你的代码 .判断循环首 (真) 延时 (1000) 写到文件 (“C:\test.txt”, 到字节集 (到文本 (取现行时间 ()))) .判断循环尾 () .子程序 Handler .参数 fdwControl, 整数型 .判断开始 (#SERVICE_CONTROL_STOP = fdwControl 或 #SERVICE_CONTROL_SHUTDOWN = fdwControl) ServiceStatus.dwWin32ExitCode = 0 ServiceStatus.dwCurrentState = #SERVICE_STOPPED SetServiceStatus (hStatus, ServiceStatus) .判断 (#SERVICE_CONTROL_PAUSE = fdwControl) ServiceStatus.dwWin32ExitCode = 0 ServiceStatus.dwCurrentState = #SERVICE_PAUSED SetServiceStatus (hStatus, ServiceStatus) .判断 (#SERVICE_CONTROL_CONTINUE = fdwControl) ServiceStatus.dwWin32ExitCode = 0 ServiceStatus.dwCurrentState = #SERVICE_RUNNING SetServiceStatus (hStatus, ServiceStatus) .默认 SetServiceStatus (hStatus, ServiceStatus) .判断结束
相关文件下载地址
©下载资源版权归作者所有;本站所有资源均来源于网络,仅供学习使用,请支持正版!

易语言编写系统服务通用框架源码》有0个想法

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注