tsinst.cpp

来自「windows ce 程序设计书 的源代码」· C++ 代码 · 共 31 行

CPP
31
字号
//======================================================================
// TSInst.cpp : Defines the entry point for the application.
//
// Written for the book Programming Windows CE
// Copyright (C) 2003 Douglas Boling
//======================================================================

#include "stdafx.h"
//#include "service.h"                 // Service includes
#include <d:\wince420\public\common\oak\inc\pservice.h>
#include <d:\wince420\public\common\sdk\inc\service.h>

int WINAPI WinMain(	HINSTANCE hInstance, HINSTANCE hPrevInstance,
				   LPTSTR lpCmdLine, int nCmdShow) {

	HANDLE hDrv = RegisterService (TEXT("TCK"), 0, 
	                               TEXT("TickSrv.dll"), 0);
	if (hDrv) {
		printf ("Service loaded. %x\r\n", hDrv);

		DWORD dwBytes;
		ServiceIoControl (hDrv, IOCTL_SERVICE_INSTALL, 0, 0, 0, 0, 
						  &dwBytes, NULL);
		printf ("Install complete\r\n");
		DeregisterService (hDrv);
	} else 
		printf ("Service failed to load. rc %d\r\n", GetLastError());
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?