SNTP Service Configuration Code Sample (Windows CE 5.0)

Send Feedback

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

Configuring the SNTP Service

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.