<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK:Запретить Lock компьютер Win7]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=8799&amp;type=atom" />
	<updated>2013-10-22T13:15:27Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=8799</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK:Запретить Lock компьютер Win7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=76328#p76328" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2013-10-22T13:15:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=76328#p76328</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:Запретить Lock компьютер Win7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=76322#p76322" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2013-10-22T09:21:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=76322#p76322</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK:Запретить Lock компьютер Win7]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=76317#p76317" />
			<content type="html"><![CDATA[<p>При окончании сессии удаленного доступа, компьютер автоматом встает в Lock режим.<br />Как возможно этого избежать?<br />Если такое невозможно, то как сделать, чтобы при появлении Lock экрана вбивался пароль и нажимался энтер.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2013-10-22T01:34:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=76317#p76317</id>
		</entry>
</feed>
