<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK:Запретить Lock компьютер Win7]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=8799</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=8799&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK:Запретить Lock компьютер Win7».]]></description>
		<lastBuildDate>Tue, 22 Oct 2013 13:15:27 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK:Запретить Lock компьютер Win7]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=76328#p76328</link>
			<description><![CDATA[<p>Разобрался.<br /></p><div class="codebox"><pre><code>Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
&quot;DisableLockWorkstation&quot;=dword:00000001</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 22 Oct 2013 13:15:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=76328#p76328</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Запретить Lock компьютер Win7]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=76322#p76322</link>
			<description><![CDATA[<p>Откопал на оф.форуме.<br />Как бы его модернизировать, чтобы в inputbox посылался пароль?<br /></p><div class="codebox"><pre><code>#include %A_ScriptDir%\lock.ahk
notify_lock_unlock()
on_lock()
{
   msgbox, locked
}

on_unlock()
{
   msgbox, unlocked
}</code></pre></div><p>lock.ahk<br /></p><div class="codebox"><pre><code>;Initialize global constants
WTS_SESSION_LOCK        :=    0x7
WTS_SESSION_UNLOCK        :=    0x8
NOTIFY_FOR_ALL_SESSIONS    :=    1
NOTIFY_FOR_THIS_SESSION    :=    0
WM_WTSSESSION_CHANGE    :=    0x02B1

notify_lock_unlock()
{
    Global WM_WTSSESSION_CHANGE
    Global NOTIFY_FOR_ALL_SESSION
    hw_ahk := FindWindowEx( 0, 0, &quot;AutoHotkey&quot;, a_ScriptFullPath &quot; - AutoHotkey v&quot; a_AhkVersion ) 
    OnMessage( WM_WTSSESSION_CHANGE, &quot;Handle_WTSSESSION_CHANGE&quot; ) 
    success := DllCall( &quot;wtsapi32.dll\WTSRegisterSessionNotification&quot;, &quot;uint&quot;, hw_ahk, &quot;uint&quot;, NOTIFY_FOR_ALL_SESSIONS )
    if( ErrorLevel OR ! success ) 
    {
        success := DllCall( &quot;wtsapi32.dll\WTSUnRegisterSessionNotification&quot;, &quot;uint&quot;, hw_ahk )
        ;If DLL registration fails, wait 20 seconds and try again
        Sleep, 20000
        notify_lock_unlock()
        ;MsgBox, [WTSRegisterSessionNotification] failed: EL = %ErrorLevel%
    }
    return
}

Handle_WTSSESSION_CHANGE( p_w, p_l, p_m, p_hw )
; p_w  = wParam   ;Session state change event
; p_l  = lParam   ;Session ID
; p_m  = Msg   ;WM_WTSSESSION_CHANGE
; p_hw = hWnd   ;Handle to Window
{
    Global WTS_SESSION_LOCK
    Global WTS_SESSION_UNLOCK
    If ( p_w = WTS_SESSION_LOCK ) 
    {
        on_lock()
    }
    Else If ( p_w = WTS_SESSION_UNLOCK ) 
    {
        on_unlock()
    }
}

FindWindowEx( p_hw_parent, p_hw_child, p_class, p_title ) 
{

    return, DllCall( &quot;FindWindowEx&quot;, &quot;uint&quot;, p_hw_parent, &quot;uint&quot;, p_hw_child, &quot;str&quot;, p_class, &quot;str&quot;, p_title ) 
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 22 Oct 2013 09:21:13 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=76322#p76322</guid>
		</item>
		<item>
			<title><![CDATA[AHK:Запретить Lock компьютер Win7]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=76317#p76317</link>
			<description><![CDATA[<p>При окончании сессии удаленного доступа, компьютер автоматом встает в Lock режим.<br />Как возможно этого избежать?<br />Если такое невозможно, то как сделать, чтобы при появлении Lock экрана вбивался пароль и нажимался энтер.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 22 Oct 2013 01:34:50 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=76317#p76317</guid>
		</item>
	</channel>
</rss>
