Launching TimeDate.cpl

  • Thread starter Thread starter Robert Misiak
  • Start date Start date
R

Robert Misiak

In a program that I wrote, it is very important for the user to have the
correct time zone configured. As such, in its properties window I display
the current configured time zone, and if it is incorrect there is a button
that the user can click on which launches TimeDate.cpl. This is how I run
it:

System.Diagnostics.Process.Start ("rundll32.exe",
"shell32.dll,Control_RunDLL TimeDate.cpl");

This works just fine in debug mode from the VS.NET development environment;
however, when I compile and install a release version, TimeDate.cpl displays
a MessageBox with this message:

"You do not have the proper privilege level to change the System Time."

The user account does have that authority, as it is the same one I was able
to run TimeDate.cpl via the VS.NET devenv. Any ideas of how to get around
this?

Thanks,
Robert
 
Alternatively, is it possible for me to programmatically change the time
zone without launching TimeDate.cpl? I did some searching around on the web
and didn't find much information about this.

Thanks,
Robert
 
Thanks, Mattias. I've actually been up all night working and was able to
implement it. The biggest confusion was that the TZI registry value is a
44-byte TIME_ZONE_INFORMATION struct, but SetTimeZoneInformation() wanted a
larger version of the struct with the two strings for the the zone ST and
DST names.

Best,
Robert

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top