|
-
Nov 18th, 2022, 05:26 PM
#1
Thread Starter
New Member
Setting the clock using VB6 - permissions and millisecond resolution
Running VB6 (SP6) under Windows 7. I'm logged in as an Administrator. I'm running the code using VB6 as a interpreter. I have not yet tried compiling anything, though that is the eventual goal.
I need a VB6 program which can read and write the system clock with a 0.1s precision.
I have found code which works just fine for reading the clock (https://home.wordpress.com/2010/04/0...-milliseconds/)
I don't fully understand how it works, but I can use it in my application without any problems. The problem I have with setting the clock is that, even just using something very simple like Date = "11/20/22" generates a runtime error 70 and a "permission denied" message. Ditto for statements like Time = "02:34:56". Permission error. Reading is fine. Setting is not.
I don't know what the code would be to set the time using the technique outlined for reading the time (presumably there's a SetSystemTime function, though I have no idea how to use it yet. Before I get into that, I want to make sure that it too won't fail due to a permission error. I have no idea what the interpreter (or complied code) runs as in terms of the permissions it has. I'm assuming if I'm an Administrator it runs with administrator permissions, but that may be (and certainly appears to be) a bad assumption!
So I have two questions - what do I need to do to make the simple Date = "11/20/22" work properly (i.e. what permissions to set/check?), and any tips on using SetSystemTime to set the time using milliseconds would also be appreciated.
Thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|