Clock dialog

T

Thore Berntsen

I have an application where it's very important that the clock on the device
is correct. Unfortunatly the clock setting is lost after a hard reset or
when the battery is empty. Is there any way I can invoke the Clock dialog
that's under Settings in my application?

Thore Berntsen
 
P

Paul G. Tobey [eMVP]

Invoke it? How would that help? I think we need a little more information
about what you are trying to accomplish (rather than how you are trying to
accomplish it, which is usually useless information). Are you planning to
just ask the user, when your application starts, if the clock is right?
That would seem to be pretty annoying and absolutely *not* certain to get
the clock to be "correct", whatever that means.

Paul T.
 
S

Sergey Bogdanov

It can be achieved by using "\Windows\ctlpnl.exe" [1]. Here you are a
sample how to open clock settings in PPC:

System.Diagnostics.Process.Start("\\Windows\\ctlpnl.exe",
String.Format("cplmain.cpl,{0},{1}", 16, 1));

FYI, Process.Start is available only for CF2.0, you have to use
OpenNETCF.Diagnostics.Process.Start for CF1.0.

[1] http://www.pocketpcdn.com/articles/controlpanel.html
 
T

Thore Berntsen

What had in mind was to check the date and time stamp of the main assembly
of my project at startup. If that date and time was newer then the date and
time of the system clock I would tell the user about the problem, and ask
the user to correct it in the dialog that is displayed after ok is clicked
in the messagebox. I think it may solve the problem. My project is a retail
application, and every thing is messed up if the clock is wrong.

Perhaps I should have said show or start instead of invoke.

I think Sergey has given me the solution.

Regards
Thore
 
T

Thore Berntsen

Thanks!
Sergey Bogdanov said:
It can be achieved by using "\Windows\ctlpnl.exe" [1]. Here you are a
sample how to open clock settings in PPC:

System.Diagnostics.Process.Start("\\Windows\\ctlpnl.exe",
String.Format("cplmain.cpl,{0},{1}", 16, 1));

FYI, Process.Start is available only for CF2.0, you have to use
OpenNETCF.Diagnostics.Process.Start for CF1.0.

[1] http://www.pocketpcdn.com/articles/controlpanel.html

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Thore said:
I have an application where it's very important that the clock on the
device is correct. Unfortunatly the clock setting is lost after a hard
reset or when the battery is empty. Is there any way I can invoke the
Clock dialog that's under Settings in my application?

Thore Berntsen
 
P

Paul G. Tobey [eMVP]

Seems like a fairly ineffective test unless you deploy a new version every
day or two, but you can use Sergey's code to open the Date/Time applet. If
you require accurate time, you should take more active measures to
synchronize the clock with a known-good one.

Paul T.
 

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

Top