<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Как задать SendMessage при активности определенного окна?]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=10960</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10960&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Как задать SendMessage при активности определенного окна?».]]></description>
		<lastBuildDate>Sun, 20 Sep 2015 12:57:41 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=97582#p97582</link>
			<description><![CDATA[<p>Мозг перестает работать, даже если поменять местами правое и левое полушарие.<br />Как мне кажется, органы обособлены друг от друга, но выходит, что не так.</p><p><span style="color: grey">Если вы хотите размещать хоткеи в любом месте, оформите их в виде ф-ии: End::func(), либо в одну строку в вашем случае.</span></p>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Sun, 20 Sep 2015 12:57:41 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=97582#p97582</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=97571#p97571</link>
			<description><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>нужно вставить в скрипт грамотно.</p></blockquote></div><p>Скрипт перестает работать, даже если перед ним есть только одна горячая клавиша для другого действия:<br /></p><div class="codebox"><pre><code>    SetTitleMatchMode 2
    DetectHiddenWindows On
    SendMode Input
    SetKeyDelay -1

END::
Reload
return

    { ; AutoSwitch Input Method
        #Persistent
    Global list := {&quot;AIMP3.exe&quot;:&quot;ru&quot;, &quot;SciTE.exe&quot;:&quot;en&quot;}

    SetWinEventHook(EVENT_SYSTEM_FOREGROUND := 0x0003, EVENT_SYSTEM_FOREGROUND, 0, RegisterCallback(&quot;HookProc&quot;, &quot;F&quot;), 0, 0, 0) 

    HookProc(hWinEventHook, event, hwnd)  { 
        WinGet, Process, ProcessName, ahk_id %hwnd%
        If (list.haskey(Process))  { 
            ControlGetFocus, CtrlFocus, ahk_id %hwnd%
            PostMessage, WM_INPUTLANGCHANGEREQUEST := 0x50, , {&quot;en&quot;:0x409,&quot;ru&quot;:0x419}[list[Process]], %CtrlFocus%, ahk_id %hwnd%
        } 
}

    SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags)  {
       Return DllCall(&quot;SetWinEventHook&quot;, UInt, eventMin , UInt, eventMax , Ptr, hmodWinEventProc
                , Ptr, lpfnWinEventProc , UInt, idProcess , UInt, idThread, UInt, dwFlags, Ptr)
    }
    }
    { ~^+C:: ; Google Search
        SendMessage, 0x50, , 0x4090409, , A
        IfWinNotActive, Vegas Pro 13.0
            {
                SendInput, ^c
                Sleep 50
                Run, http://www.google.com/search?q=%clipboard%
            }
        return
    }</code></pre></div><p>Как мне кажется, действия обособлены друг от друга, но выходит, что не так.</p>]]></description>
			<author><![CDATA[null@example.com (becauseim)]]></author>
			<pubDate>Sat, 19 Sep 2015 06:37:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=97571#p97571</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=97558#p97558</link>
			<description><![CDATA[<p>Проще, чем там, варианта нет, просто нужно вставить в скрипт грамотно, так, чтобы первая часть кода (создание массива и вызов функции) выполнилась, т. е. до первого <em>Return</em>.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 18 Sep 2015 14:24:21 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=97558#p97558</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=97557#p97557</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, т.е. вариант, указанный в первом посте не должен работать ни при каких условиях, кроме как по нажатию заданной горячей клавиши?</p>]]></description>
			<author><![CDATA[null@example.com (becauseim)]]></author>
			<pubDate>Fri, 18 Sep 2015 14:23:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=97557#p97557</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=97554#p97554</link>
			<description><![CDATA[<p><strong>teadrinker</strong>, да, но он у меня работает лишь после запуска отдельным файлом. А по сути, мне эта функция нужна прежде всего для одной программы, поэтому, хотел бы осуществить ее в уже существующем скрипте простым SendMessage, который отлично срабатывает по горячей клавише, а вот по активации целевого окна, почему-то не срабатывает.</p>]]></description>
			<author><![CDATA[null@example.com (becauseim)]]></author>
			<pubDate>Fri, 18 Sep 2015 14:01:00 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=97554#p97554</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=97553#p97553</link>
			<description><![CDATA[<p>Так <a href="http://forum.script-coding.com/viewtopic.php?pid=97285#p97285">здесь</a> же ответили, вроде?</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 18 Sep 2015 13:55:36 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=97553#p97553</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Как задать SendMessage при активности определенного окна?]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=97552#p97552</link>
			<description><![CDATA[<div class="codebox"><pre><code>
    SetTitleMatchMode 2
    DetectHiddenWindows On
    SendMode Input
    SetKeyDelay -1

   #IfWinActive, ahk_exe skype.exe
        Loop
            {
                SendMessage, 0x50, , 0x4090409, , A
            }
   return
</code></pre></div><p>Не знаю, все ли правильно, но такой вариант у меня, к сожалению, не сработал.</p>]]></description>
			<author><![CDATA[null@example.com (becauseim)]]></author>
			<pubDate>Fri, 18 Sep 2015 12:53:11 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=97552#p97552</guid>
		</item>
	</channel>
</rss>
