Reputation: 97
What is the most appropriate method to change the system date (on Windows) programmatically using Qt4. I'm using Qt Creator 1.3.1.
Upvotes: 1
Views: 3371
Reputation:
Use Windows API, GetLocalTime and SetLocalTime.
SYSTEMTIME localTime;
GetLocalTime(&localTime);
localTime.wHour = 21;
localTime.wMinute = 30;
if (SetLocalTime(&localTime) != 0)
{
// ok
}
else
{
// failed
}
Upvotes: 5