You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
It's not that difficult. Attached is the HelloWin sample program that requests elevation at startup. I simply added the manifest file to the resource file. Notice the line in the manifest that contains <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />. The program will bring up the UAC dialog, if you allow it, the program runs with Administrator privileges. That's all there is to it
Why would a 'general purpose' application program want/need to change the system date at all?
Seems to me if the system clock goes wonky, that's why system adminstrators have phones on their desks.
Inquiring Minds Want to Know!!
Well, maybe you need to journal (audit) all changes made to sensitive information (like patient records) and you need to make sure that you can track each change chronologicly. If the local clock is "wonky" then your journal (audit) is worthless. So you sync to a central time server when your "general purpose" application starts. Problem solved!
If that is a requirement, there are plenty of ways to get the correct time, such as the network time function or an internet server. Using TIME$ or DATE$, or modifying the system time would not be a first choice - a simple offset to keep in sync will work.
The point of maintaining privileges is that they are not available to just any user - for example: adjusting the access tokens or requesting an admin password will simply not work with limited user accounts. Same as with the UAC and "protected" folders: you just have to learn to work within these set limitations.
If that is a requirement, there are plenty of ways to get the correct time, such as the network time function or an internet server. Using TIME$ or DATE$, or modifying the system time would not be a first choice - a simple offset to keep in sync will work.
The point of maintaining privileges is that they are not available to just any user - for example: adjusting the access tokens or requesting an admin password will simply not work with limited user accounts. Same as with the UAC and "protected" folders: you just have to learn to work within these set limitations.
I don't disagree one bit with what you posted. MCM wanted an example of when futzing with the system time was pertinent. I gave him one.
In your example, resetting the system time has (at least) TWO flaws...
First, as pointed out if you want to have many users storing chronologically, you don't need the system time reset. You can use an external time source or an offset from a 'trusted source'
Second, you could simply append records to the journal. As long as "Time Itself" is the same for all users, this will result in chronological storage.
I can see setting the system time on a network client when the system boots to synch it up with some reference, but I would think you would do that with something using a manifest to elevate that bootup program to the requisite privileges.
I like Edwin's answer... curiosity is a perfectly valid reason for asking.
Reason I ask is that I request the permission to set time, just curious if it works on VIsta...
The only bug I've had is that if the time packet comes back empty, on RARE occasions it sets the clock year to 1900.....
That's rare though, only started after the new DST and only until the OLD DST date...
Scott Turchin
MCSE, MCP+I http://www.tngbbs.com
---------------------- True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment