DATE$ function - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: DATE$ function (/showthread.php?tid=2060) |
RE: DATE$ function - TerryRitchie - 10-04-2023 (10-04-2023, 10:36 PM)SMcNeill Wrote: Did you try "Run as admin"? Windows really doesn't want folks to do much tinkering on date and time anymore, as they like to sync things all nice and neat via the web. I honestly can't think of the last time that I've ever had to manually set the date and time on any of my PCs.And even if you do get the software to change the date and time Windows would probably just resync it a short time later any way. I know Windows Update will fail hard if the date/time in your computer is incorrect. I can't think of any reason why I would want to have software change the date/time. I have not had to do that since the DOS days and PCs that didn't contain a clock chip like a Dallas and battery backup. If you're writing software that changes depending on the time of day (like bplus' banner) then a quick manual forced change to trick your software into believing the time/date is different is easily done and then removed before the final version. RE: DATE$ function - eoredson - 10-04-2023 Huh. As usual Steve, you have solved the problem for another DUH of mine. Yes, running as admin makes it work!? Erik. RE: DATE$ function - eoredson - 10-04-2023 The solution: RightClick QB64pe desktop shortcut properties -> Advanced -> checkbox run as admin. Most simple fix. Erik. https://learn.microsoft.com/en-us/windows/win32/secbp/running-with-special-privileges RE: DATE$ function - eoredson - 10-05-2023 There may be a difference between SetLocalTime and SetSystemTime where the latter is UTC. In control panel the date/time setting for internet clock will autoset the realtime anyway independent of what you set it for. Erik. RE: DATE$ function - SpriggsySpriggs - 10-05-2023 I've got code somewhere to make a program launch itself as admin. If I find it, I'll send it your way, eoredson. EDIT: Looks like I found it Of course, you'll have to accept the UAC prompt. Code: (Select All)
RE: DATE$ function - eoredson - 10-06-2023 Heh.. I tried this: Code: (Select All) Declare Dynamic Library "Shell32" RE: DATE$ function - SpriggsySpriggs - 10-06-2023 Yeah. You have to leave the code as is. The `System` call is important. As is the `IsUserAnAdmin` check. RE: DATE$ function - eoredson - 10-06-2023 I removed the comment from 'System and it went into an endless loop anyway. If IsUserAnAdmin check when 0 going to do the same thing? Erik. RE: DATE$ function - SpriggsySpriggs - 10-06-2023 It shouldn't do that. I've never seen it constantly loop on just that alone because it should report zero for normal user and nonzero for admin. If you cancel the UAC prompt, it is just going to close out anyways because the next statement is `System`. I've never had any issues using it, though. It (`SelfElevate`) is a big part of my registry library. But for future reference, leave the function as I provided. It was written this way for a reason. RE: DATE$ function - eoredson - 10-06-2023 I have QB64pe with admin and QB64 without and all I can say is that the following code works: Code: (Select All) Rem Admin.bas forces user to become admin. |