Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Launching TimeDate.cpl

1 view
Skip to first unread message

Robert Misiak

unread,
Jun 12, 2004, 9:14:37 PM6/12/04
to
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


Robert Misiak

unread,
Jun 12, 2004, 11:40:25 PM6/12/04
to
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


"Robert Misiak" <chrono...@yahoo-cut.this.part.out-.com> wrote in
message news:1UNyc.3080$Wr....@newsread1.news.pas.earthlink.net...

Mattias Sjögren

unread,
Jun 13, 2004, 7:19:16 AM6/13/04
to
Robert,

>Alternatively, is it possible for me to programmatically change the time
>zone without launching TimeDate.cpl?


http://msdn.microsoft.com/library/en-us/sysinfo/base/settimezoneinformation.asp

Declaration available at http://www.pinvoke.net

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Robert Misiak

unread,
Jun 13, 2004, 1:35:35 PM6/13/04
to
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

--

"Mattias Sjögren" <mattias.don...@mvps.org> wrote in message
news:eTrtMhTU...@tk2msftngp13.phx.gbl...

0 new messages