SNTP Service Configuration Code Sample (Windows CE 5.0)
The following code example shows how to configure the SNTP service for Windows CE using Services.exe:
int WINAPI
WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
#ifdef UNDER_NT
LPSTR lpCmdLine,
#else
LPWSTR lpCmdLine,
#endif
int nCmdShow)
{
HANDLE hFile=CreateFile(L"NTP0:",GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
if(INVALID_HANDLE_VALUE==hFile)
return 0;
WCHAR szControlString[]=L"sync";
DWORD dwLenIn=sizeof(szControlString);
DWORD dwBytesReturned;
DeviceIoControl(hFile, IOCTL_SERVICE_CONTROL, szControlString, dwLenIn, NULL, 0, &dwBytesReturned, NULL);
return 0;
}
See Also
Send Feedback on this topic to the authors