Accessing Internal Clock

Sohaila Taravati

Registered User.
Local time
Today, 19:49
Joined
Oct 24, 2001
Messages
266
How can I access the internal clock from a button on my form? You know the clock where your double click on your time on your computer and it pops up. I just can't find it to call it! Does anybody know where to access it? Thanks
 
Thanks for your reply. I have used this code also before, but I want to access the internal clock of the computer!
 
From a command button called cmdShowClock

In the Forms class module: -

Code:
Private Sub cmdShowClock_Click()

    ShowClock

End Sub
And in a Global module: -
Code:
Public Sub ShowClock()

    Shell "Control.exe Date/Time"

End Sub
This has only been tested under Win2000.

Hope it works for you.

Regards
Chris
 
Works fine with Windows 98 and Access 97 on my home PC.
 
Thanks ghudson

Any chance of testing it under XP?
Why I ask is that "Control.exe Date/Time" (one or the other or both) may have changed names.

Thanks for the input.

Regards
Chris
 
Public Sub ShowClock()
Shell "Control.exe Date/Time"
End Sub

Works fine with Windows XP and Access 97.
 
Thanks for testing that ghudson.

Looks like it works from 98 to XP which tends to make one think it's stable.

Thanks again and regards
Chris
 
Re previous post and desire to access the internal clock...

Where do you suppose Now() is coming from, if not the internal clock? Change the internal clock setting and Now() follows closely behind. How's a thing like that work?
 
Last edited:
raskew

I'm not sure of the exact question or who it is addressed to.

Sohaila was looking to access the internal clock not just the Date and Time.

So I guess the real question is "How's a thing like that work?"

Shell "Control.exe Date/Time"

Shell fires up Control.exe, which is in effect Control Panel, and passes the argument "Date/Time".

Note that "Date/Time" is the caption/label for the clock in Control Panel.

These are the four that I have tested so far: -

Shell "Control.exe Mouse"
Shell "Control.exe Date/Time"
Shell "Control.exe Printers"
Shell "Control.exe Keyboard"

I don't know the syntax for any of the others but they may exist.

Chris
 
I wish that

Shell "Control.exe Display"

would open the Display options.

Any suggestions?
 
Hi ghudson

Yes I tried that too and as you found it doesn't work. There's got to be a way, "never say die", maybe an API call.

I'll have a look around.

Have you done a search either here or in "the other place"?
I'll go and have a look for an API.

Regards
Chris.
 
Just what I was looking for! :D

'Opens the Windows Control Panel's Display Properties...
Shell "control.exe desk.cpl Display,1", vbNormalFocus 'Screen Saver
Shell "control.exe desk.cpl Display,2", vbNormalFocus 'Appearance
Shell "control.exe desk.cpl Display,3", vbNormalFocus 'Settings
Shell "control.exe desk.cpl Display,4", vbNormalFocus 'Background

The above works fine with Windows 98 and Access 97. Does anybody else want to test it?
 
Yes they work with Win2000.

Here's a few more that have been tested with Win2000 and XP.

Regards
Chris
 

Attachments

Users who are viewing this thread

Back
Top Bottom