Windows系统服务创建步骤,常用类封装,废话不多说,直接上代码
1 // ServceDemo.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include "WindwosService.h" 6 7 unsigned __stdcall SvcRun (void *Params ) 8 { 9 while(1) 10 { 11 12 for (int i = 0;i < 100;i++) 13 { 14 printf("%d\n",i); 15 } 16 17 ::Sleep(1*60*1000); 18 } 19 return 0; 20 } 21 22 int _tmain(int argc, _TCHAR* argv[]) 23 { 24 #ifdef WIN32 25 InitService(argc,argv); 26 #endif // WIN32 27 28 #ifdef linux 29 30 #endif // linux 31 32 return 0; 33 }