<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK:SetSystemTime в Win7 x64 проблема...]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6762&amp;type=atom" />
	<updated>2012-02-03T08:11:13Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6762</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK:SetSystemTime в Win7 x64 проблема...]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56350#p56350" />
			<content type="html"><![CDATA[<p>Александр_, спасибо! Ваш скрипт решил мою проблему.</p>]]></content>
			<author>
				<name><![CDATA[sind-rom]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27186</uri>
			</author>
			<updated>2012-02-03T08:11:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56350#p56350</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:SetSystemTime в Win7 x64 проблема...]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56344#p56344" />
			<content type="html"><![CDATA[<p>OFF: История для bash.org <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" />.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2012-02-03T05:23:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56344#p56344</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:SetSystemTime в Win7 x64 проблема...]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56343#p56343" />
			<content type="html"><![CDATA[<p>Какой кошмар... Вот что значит бездумно запускать скрипты <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> <br /><strong>Александр_</strong>, скомпилировал ваш скрипт и запустил 2 раза, подумал - не работает, ну и ладно.<br />Потом почти час воевал с Касперским по поводу закончившийся лицензии, лишь случайно заметил, что на компьютере установлен 2014 год <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2012-02-03T04:56:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56343#p56343</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:SetSystemTime в Win7 x64 проблема...]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56332#p56332" />
			<content type="html"><![CDATA[<p>SetSystemTime оперирует временем по гринвичу(GMT+0), с учётом локальных настроек действует SetLocalTime. В любом случае лучше получать время тоже через апи, там удобный формат.<br /></p><div class="codebox"><pre><code>VarSetCapacity(Cur, 16, 0)
DllCall(&quot;GetSystemTime&quot;, &quot;ptr&quot;, &amp;Cur)
NumPut(NumGet(&amp;Cur, 0, &quot;ushort&quot;)+1, &amp;Cur, 0, &quot;ushort&quot;)
if(!DllCall(&quot;SetSystemTime&quot;, &quot;ptr&quot;, &amp;Cur))
   msgbox %a_lasterror%</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Александр_]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24888</uri>
			</author>
			<updated>2012-02-02T15:17:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56332#p56332</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK:SetSystemTime в Win7 x64 проблема...]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=56331#p56331" />
			<content type="html"><![CDATA[<p>Пишу скрипт, который меняет системное время на один год. В за основу взял скрипт, приведенный в справке:<br /></p><div class="codebox"><pre><code>Gui, Add, Button, x16 y137 w260 h40 gButtonPressed vButtonText, Уменьшить на год
Gui, Show, w288 h189, Date changer
return

ButtonPressed:
vTime := A_Now 
if(fFlag == &quot;YEARDOWN&quot;)
{	
	vTime += 10000000000
	A := SetSystemTime(vTime)
	MsgBox %A% ;отобразить возврат функции
	MsgBox %A_Now% ;отобразить текущее время, поменялось или нет
	GuiControl,, ButtonText, Уменьшить на год
	fFlag := &quot;YEARUP&quot;
}
else
{
	vTime -= 10000000000
	A := SetSystemTime(vTime)
	MsgBox %A%
	MsgBox %A_Now%
	GuiControl,, ButtonText, Увеличить на год
	fFlag := &quot;YEARDOWN&quot;
}
return

GuiClose:
if(fFlag == &quot;YEARDOWN&quot;)
{	
	vTime := A_Now + 10000000000
	SetSystemTime(%vTime%)
}
ExitApp

SetSystemTime(YYYYMMDDHHMISS)
; Sets the system clock to the specified date and time.
; Caller must ensure that the incoming parameter is a valid date-time stamp
; (local time, not UTC). Returns non-zero upon success and zero otherwise.
{
    ; Convert the parameter from local time to UTC for use with SetSystemTime().
    UTC_Delta -= %A_NowUTC%, Seconds  ; Seconds is more accurate due to rounding issue.
    UTC_Delta := Round(-UTC_Delta/60)  ; Round to nearest minute to ensure accuracy.
    YYYYMMDDHHMISS += %UTC_Delta%, Minutes  ; Apply offset to convert to UTC.

    VarSetCapacity(SystemTime, 16, 0)  ; This struct consists of 8 UShorts (i.e. 8*2=16).

    StringLeft, Int, YYYYMMDDHHMISS, 4    ; YYYY (year)
    NumPut(Int, SystemTime, 0, &quot;UShort&quot;)
    StringMid, Int, YYYYMMDDHHMISS, 5, 2  ; MM (month of year, 1-12)
    NumPut(Int, SystemTime, 2, &quot;UShort&quot;)
    StringMid, Int, YYYYMMDDHHMISS, 7, 2  ; DD (day of month)
    NumPut(Int, SystemTime, 6, &quot;UShort&quot;)
    StringMid, Int, YYYYMMDDHHMISS, 9, 2  ; HH (hour in 24-hour time)
    NumPut(Int, SystemTime, 8, &quot;UShort&quot;)
    StringMid, Int, YYYYMMDDHHMISS, 11, 2 ; MI (minute)
    NumPut(Int, SystemTime, 10, &quot;UShort&quot;)
    StringMid, Int, YYYYMMDDHHMISS, 13, 2 ; SS (second)
    return DllCall(&quot;SetSystemTime&quot;, UInt, &amp;SystemTime)
}</code></pre></div><p>Не работает...<br />Система Win7 x64. Установлен AutoHotkey_L.<br />При работе из под пользователя, функция SetSystemTime() возвращает нулевое значение.<br />Если скрипт скомпилировать в .exe и запустить под администратором, то SetSystemTime() возвращает единицу (1), но системное время все равно не изменяется. <br />Запуск функции напрямую, как в примере, SetSystemTime(&quot;20051008142211&quot;)&nbsp; &nbsp;- дает тот же результат, что и ранее.<br />Вероятно, это из за операционной системы. Заставить работать скрипт не получается.<br />Помогите советом...</p>]]></content>
			<author>
				<name><![CDATA[sind-rom]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27186</uri>
			</author>
			<updated>2012-02-02T14:50:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=56331#p56331</id>
		</entry>
</feed>
