Posts

Programmatically setting SYSTEMTIME in Windows 8/10 - an exercise in madness!

Image
"They say time is the fire in which we burn" It started out as a simple request... add a page to a custom embedded WPF application that will allow the user to set the date/time directly from the application. Seemed simple enough. I created the following screen (only a portion of the screen is shown below): Now, for better or worse, I do a large majority of my development on Windows 7 machines even if the target is a Windows 8/10 machine where the application will be deployed. In general, what works on Windows 7 usually  works on Windows 8/10, or so you would think. This works on Windows 7, but as you would expect, it fails on Windows 8/10. We get back the dreaded E_NOACCESS. Even running as Admin under the BUILTIN\Administrators group with UAC off, we still get the same thing. Time to do some Google searching. A quick search reveals posts on StackOverflow and MSDN that our user requires privileges to change the system time. That actually makes sense,