I'm porting an application from Windows 2000 (don't ask) to Windows 7 and I need to replicate functionality that allows the user to set the time from a GUI. Previously this had been done with a call directly to 'time' using the command prompt, but it appears the user permissions have changed somewhat in Windows 7.
Having done some research, it appears that you can set the time using a call to the kernel32.dll
method Win32SetSystemTime
, but the same permissions issue arises. Reading MSDN I think I need to enable SE_SYSTEMTIME_NAME
, however no matter what I try I can't seem to make this work.
Does anyone have some tested example code for Windows 7 to allow an API call to Win32SetSystemTime
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…