473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Launching TimeDate.cpl

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
Nov 16 '05 #1
3 6253
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" <ch***********@yahoo-cut.this.part.out-.com> wrote in
message news:1U****************@newsread1.news.pas.earthli nk.net...
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

Nov 16 '05 #2
Robert,
Alternatively, is it possible for me to programmatically change the time
zone without launching TimeDate.cpl?

http://msdn.microsoft.com/library/en...nformation.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.
Nov 16 '05 #3
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" <ma********************@mvps.org> wrote in message
news:eT**************@tk2msftngp13.phx.gbl...
Robert,
Alternatively, is it possible for me to programmatically change the time
zone without launching TimeDate.cpl?

http://msdn.microsoft.com/library/en...nformation.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.

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Terry | last post by:
When launching our application with Internet Explorer already opened, but not pointing to our web server, the session variables disappear. If you open I.E. after launching our app, it works fine....
6
by: JerryP | last post by:
Hello, is there a way to launch the property dialogue for a directory from my c# app ? I would also like to launch the User Account Properties from Active Directory Users and Computers, and the...
0
by: Scott Zabolotzky | last post by:
I'm using the following code to launch SIGNCODE.EXE to sign a CAB provisioning file from an ASP.NET app. When I run the code the exit code comes back as -1. I have not been able to determine what...
7
by: dhussong | last post by:
I have created a Setup and Deployment project in Visual Studio.NET 2003. After my installation has completed running I'd like to launch the EXE that I just installed. I've found how to launch the...
1
by: John A. Bailo | last post by:
Excuse the novice aspects of this question, but: What techniques are available to me for launching one c# application ( console .exe) from another? For example, I know there is the Process and...
0
by: microb0x | last post by:
Is there any difference in the way an Access .mdb file is launched from directly double-clicking the file through windows explorer versus using code within another Access file to launch the...
0
by: Micheline | last post by:
How do I change the date or time field of the timedate control panel using the shell command (without displaying the applet). For example, I can change the timezone by specifying "control.exe...
6
by: ssmeshack | last post by:
Hi All, I have problem that give error for timedate cell where I done some color coding. DateTime datenow = DateTime.Now; DateTime datethen =...
2
by: Big D | last post by:
Is there a way to embed timedate.cpl into a form?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.