我用标准c作了一个标准的系统服务,当时我不了解如何将它注册的windows系统服务里!
请教高手帮忙??
请教高手帮忙??
解决方案 »
- [GDI]每做一次绘制,就需要重新GetDC()么?
- 这段代码我经常看到,做什么用的呢?
- 那位大哥能帮忙解析一下,文件在网络传输中的包头和包尾的结构,要原始数据包的,100分相送
- SetDialogBkColor的问题,非常急
- 如果在动态创建的窗口上面动态创建控件?
- 编译提示错误如下,如何解决?
- 谁知道中科大洋的情况?
- 在win2000、98下如何得到硬盘物理的序列号!(非逻辑序列号)~(比较难)
- 多线程使用oledb访问数据库,连接池建多个CDataSource好?还是一个CDataSource中建多个CSession好?
- 我要问一个书名,??? VC++6.0技术内幕。希望哪位知道的能够指点一二:)
- 请教大家一个SQL语句的写法!请您多指点指点!谢谢!
- win2000中怎么加载自己的服务
里masterz给出的那个程序是集服务程序与服务管理程序于一身的最简单的代码。
#include <windows.h>
#include <iostream.h>void ErrorHandler(char *s, DWORD err)
{
cout << s << endl;
cout << "Error number: " << err << endl;
ExitProcess(err);
}void main(int argc, char *argv[])
{
SC_HANDLE newService, scm;
if (argc != 4)
{
cout << "Usage:\n";
cout << " install service_name \
service_label executable\n";
cout << " service_name is the \
name used internally by the SCM\n";
cout << " service_label is the \
name that appears in the Services applet\n";
cout << " (for multiple \
words, put them in double quotes)\n";
cout << " executable is the \
full path to the EXE\n\n";
return;
}
// open a connection to the SCM
scm = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
if (!scm) ErrorHandler("In OpenScManager",
GetLastError());
// Install the new service
newService = CreateService(
scm, argv[1], // eg "beep_srv"
argv[2], // eg "Beep Service"
SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL,
argv[3], // eg "c:\winnt\xxx.exe"
0, 0, 0, 0, 0);
if (!newService) ErrorHandler("In CreateService",
GetLastError());
else cout << "Service installed\n";
// clean up
CloseServiceHandle(newService);
CloseServiceHandle(scm);
}