C++ implements a simple example of system call time

  • 2020-04-02 02:29:42
  • OfStack

This paper briefly describes a simple example of system call time based on VC++, here only listed the main part of the code, for your reference, as follows:

The first thing to notice is to add a header file:


#include <Windows.h>

Then it will be simple, here only stick out the main usage as follows:


#ifdef _SECURITY
 SYSTEMTIME sysTime;
  ZeroMemory(&sysTime, sizeof(sysTime));
  GetLocalTime(&sysTime);
 if (sysTime.wYear > _DURE_DATE_YEAR)
 exit(0);
 else if (sysTime.wYear == _DURE_DATE_YEAR && sysTime.wMonth > _DURE_DATE_MONTH)
 exit(0);
 else if (sysTime.wYear == _DURE_DATE_YEAR && sysTime.wMonth == _DURE_DATE_MONTH && sysTime.wDay >= _DURE_DATE_DAY)
 exit(0);
#endif // _SECURITY

Related articles: