<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Альтернатива BlockInput]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9710&amp;type=atom" />
	<updated>2014-06-22T17:12:04Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9710</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84102#p84102" />
			<content type="html"><![CDATA[<p>При нажатии мышью на заголовок текущая ветвь скрипта прерывается. Это можно проследить на примере:<br /></p><div class="codebox"><pre><code>Gui, Show, w300 h100
Loop
{
   ToolTip % A_Index
   Sleep, 300
}</code></pre></div><p>Перетаскивайте окно за заголовок — отсчёт прервётся.<br />Обойти можно так:<br /></p><div class="codebox"><pre><code>Gui, Show, w300 h100
Return

LButton::
   if (условие)
      Return
   Send {LButton Down}
   Return

LButton Up::
   Send, {LButton Up}
   Return</code></pre></div><p>Хоткей <em>LButton Up</em> запускает новую ветвь и она выполняется.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-06-22T17:12:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84102#p84102</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84099#p84099" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Со всеми будет проблематично.</p></blockquote></div><p>&nbsp; С мышью тоже не просто оказалось. Два дня бился со странным глюком в своём скрипте: при перетаскивании окна gui за заголовок,&nbsp; курсор намертво &quot;прилипал&quot; к заголовку и окно следовало за ним как привязанное. Думал где-то перехват происходит или ещё как-то прерывается действие, но даже critical&nbsp; не спасал. Стал удалять код блок за блоком. В итоге осталось вот это:<br /></p><div class="codebox"><pre><code>LButton::
    {
    Send {LButton Down}
    KeyWait,LButton
    Send {LButton Up}
    }
return

1::
Gui,Show, x100 y100 w300 h200,Gui
Return


2::
ExitApp</code></pre></div><p>&nbsp; И курсор по прежнему &quot;прилипает&quot;. Судя по всему до KeyWait действия не доходят. Даже вот в таком варианте<br /></p><div class="codebox"><pre><code>LButton::
    {
    Send {LButton Down}
    SoundBeep
    Send {LButton Up}
    }
return

1::
Gui,Show, x100 y100 w300 h200,111
Return


2::
ExitApp</code></pre></div><p> при клике на заголовок окна gui, звук не воспроизводится.</p><p> Что за странный феномен и как от него можно избавиться?</p><br /><p>&nbsp; Foma, у тебя применяется gui в скрипте?</p>]]></content>
			<author>
				<name><![CDATA[Pogodin]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30956</uri>
			</author>
			<updated>2014-06-22T16:08:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84099#p84099</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84027#p84027" />
			<content type="html"><![CDATA[<p>Со всеми будет проблематично.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-06-20T14:10:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84027#p84027</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84024#p84024" />
			<content type="html"><![CDATA[<p>Просто и эффективно с мышью получилось. А со всеми сразу клавишами также просто нельзя?</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2014-06-20T12:24:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84024#p84024</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84023#p84023" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Foma пишет:</cite><blockquote><p>А можно подробнее о последствиях такого влияния?</p></blockquote></div><p>Функции <em>LowLevelMouseProc()</em> и <em>LowLevelKeyboardProc()</em> для корректной работы других приложений, где установлены подобные хуки, должны возвращать<br /></p><div class="codebox"><pre><code>Return DllCall(&quot;CallNextHookEx&quot;, Ptr, 0, Int, nCode, UInt, wParam, UInt, lParam)</code></pre></div><p>У нас же они возвращают 1, соответственно другие приложения в этот период не будут получать hook-уведомлений и могут работать некорректно.<br /></p><div class="quotebox"><blockquote><p>Но как быть, с перетаскиванием? Можно что-то придумать?</p></blockquote></div><div class="codebox"><pre><code>LButton::
if (условие)
    return
else
{
   Send {LButton Down}
   KeyWait, LButton
   Send {LButton Up}
}
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-06-20T11:59:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84023#p84023</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84022#p84022" />
			<content type="html"><![CDATA[<p>И ещё вопрос. Наверное можно заменить блокировку мыши определённой процедурой, которая будет игнорировать клик при определённых условиях, а без них работать как обычно.<br />&nbsp; Для клика реализовать это просто<br /></p><div class="codebox"><pre><code>
LButton::
if (условие)
    return
else
    click
return</code></pre></div><p>Но как быть, с перетаскиванием? Можно что-то придумать?</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2014-06-20T11:51:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84022#p84022</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84020#p84020" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Применять с осторожностью, может повлиять на другие приложения, использующие аналогичные хуки.</p></blockquote></div><p>&nbsp; А можно подробнее о последствиях такого влияния?</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2014-06-20T11:40:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84020#p84020</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84010#p84010" />
			<content type="html"><![CDATA[<p>Работет. И антивирь молчит. Спасибо!</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2014-06-19T23:21:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84010#p84010</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84007#p84007" />
			<content type="html"><![CDATA[<p>Блокируем на 5 сек мышь и клавиатуру:<br /></p><div class="codebox"><pre><code>OnExit, Exit
hHookMouse := DllCall(&quot;SetWindowsHookEx&quot;
   , Int, WH_MOUSE_LL := 14
   , Ptr, RegisterCallback(&quot;LowLevelMouseProc&quot;, &quot;Fast&quot;)
   , Ptr, DllCall(&quot;GetModuleHandle&quot;, UInt, 0, Ptr)
   , UInt, 0, Ptr)
   
hHookKeybd := DllCall(&quot;SetWindowsHookEx&quot;
   , Int, WH_KEYBOARD_LL := 13
   , Ptr, RegisterCallback(&quot;LowLevelKeyboardProc&quot;, &quot;Fast&quot;)
   , Ptr, DllCall(&quot;GetModuleHandle&quot;, UInt, 0, Ptr)
   , UInt, 0, Ptr)
   
Sleep 5000
DllCall(&quot;UnhookWindowsHookEx&quot;, Ptr, hHookMouse), hHookMouse := &quot;&quot;
DllCall(&quot;UnhookWindowsHookEx&quot;, Ptr, hHookKeybd), hHookKeybd := &quot;&quot;
Return

Exit:
   (hHookMouse &amp;&amp; DllCall(&quot;UnhookWindowsHookEx&quot;, Ptr, hHookMouse))
   (hHookKeybd &amp;&amp; DllCall(&quot;UnhookWindowsHookEx&quot;, Ptr, hHookKeybd))
   ExitApp

LowLevelMouseProc(nCode, wParam, lParam)
{
   Return 1
}

LowLevelKeyboardProc(nCode, wParam, lParam)
{
   Return 1
}</code></pre></div><p>Применять с осторожностью, может повлиять на другие приложения, использующие аналогичные хуки.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-06-19T21:06:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84007#p84007</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83980#p83980" />
			<content type="html"><![CDATA[<p>Какие ещё способы временно заблокировать клавиатуру и кнопки мыши?</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2014-06-18T18:26:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83980#p83980</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83979#p83979" />
			<content type="html"><![CDATA[<p>Антивирусник блокирует за &quot;Прямой доступ к клавиатуре&quot;. И никак нельзя настроить. Даже добавление в исключения не помогает. Жесть...</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2014-06-18T16:46:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83979#p83979</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83975#p83975" />
			<content type="html"><![CDATA[<p>Проверил, срабатывает.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2014-06-18T13:56:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83975#p83975</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Альтернатива BlockInput]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=83974#p83974" />
			<content type="html"><![CDATA[<p>Дело оказалось совсем в другом, поэтому меняю название темы и вопрос. Который теперь звучит так:<br /><strong>Какие существуют способы, кроме BlockInput, временно заблокировать клавиатуру и кнопки мыши?</strong></p><br /><br /><br /><br /><br /><p>Устарело:<br /></p><div class="quotebox"><blockquote><p>По какой причине может не срабатывать BlockInput в таком виде <br /></p><div class="codebox"><pre><code>F1::
ToolTip,start
BlockInput,on
Sleep, 10000    
BlockInput, off
ToolTip,End
Sleep, 500
ExitApp</code></pre></div><p> в скомпилированном файле?</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2014-06-18T12:32:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=83974#p83974</id>
		</entry>
</feed>
