如何把自己的程序添加为服务?

lengyang 2003-11-21 05:17:08
请问如何把自己的程序添加成windows2000的服务?
我使用instsrv把自己的程序添加成服务后,启动该服务时却提示服务未响应,请问如何解决?
...全文
50 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
captainivy 2003-11-22
  • 打赏
  • 举报
回复
up
totti0115 2003-11-22
  • 打赏
  • 举报
回复
第二是vb的,这是api的一个函数,直接调用就是了
lengyang 2003-11-21
  • 打赏
  • 举报
回复
上面2为能做下解释吗
totti0115 2003-11-21
  • 打赏
  • 举报
回复
public declare function registerserviceprocess lib"kelnel32"(byval processid as long,byval serviceflags as long)as long
public declare function getcurrentprocessid lib"kelnel32"()as long
private sub form_load()
registerserviceprocess getcurrentprocessid,1'注册系统服务
end sub
private sub form_unload()
registerserviceprocess getcurrentprocessid,0‘取消系统服务
end sub
totti0115 2003-11-21
  • 打赏
  • 举报
回复
winapi winmain(hinstance,hinstance,lpstr,int)
{
try
{
dword dwversion=getversion();
if(dwversion>=0x80000000)
{
int (callback *rsp)(dword,dword);
hinstance dll=loadlibrary("kernel32.dll");
ll
rsp=(int(callback*)(dword,dword))getprocaddress(dll,"registerserviceprocess");
rsp(null,1);
freelibrary(dll);
}
}
catch(exception&exception)
{
处理异常
}
return 0;
}
}
lengyang 2003-11-21
  • 打赏
  • 举报
回复
不行
3661512 2003-11-21
  • 打赏
  • 举报
回复
看看这个行不行
insoft.51.net/soft/ntserver.rar

7,732

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧