<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Запрет активации окна]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10891&amp;type=atom" />
	<updated>2015-08-22T17:27:50Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10891</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96757#p96757" />
			<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>2015-08-22T17:27:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96757#p96757</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96756#p96756" />
			<content type="html"><![CDATA[<p>А тут читал?<br /><a href="https://social.msdn.microsoft.com/Forums/vstudio/en-US/e7fef568-2c0b-41eb-9785-304f84d03819/how-to-prevent-a-form-from-being-activatedgaining-focus?forum=csharpgeneral">https://social.msdn.microsoft.com/Forum … arpgeneral</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-08-22T17:25:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96756#p96756</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96753#p96753" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> Спасибо за разъяснения.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-08-22T16:09:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96753#p96753</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96752#p96752" />
			<content type="html"><![CDATA[<p>Но это то же самое, что<br /></p><div class="codebox"><pre><code>Run, notepad,, Min</code></pre></div><p><img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-08-22T15:49:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96752#p96752</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96751#p96751" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>процесс не ты создаёшь, а скомпилированный исполняемый файл приложения</p></blockquote></div><p>Не, не прав. Если приложение запускается кликом по исполняемому файлу, процесс создаёт система от имени пользователя с установками по умолчанию, если запускать скриптом — можно выставить свои установки:<br /></p><div class="codebox"><pre><code>CreateProcess(&quot;notepad&quot;, SW_MINIMIZE := 6)

CreateProcess(CommandLine, ShowWindow = 0, flag = 0)  {
   static STARTF_USESHOWWINDOW := 1
   
   VarSetCapacity(STARTUPINFO, size := 4*A_PtrSize + 8*4 + 5*A_PtrSize, 0)
   NumPut(size, STARTUPINFO)
   
   (ShowWindow &amp;&amp; NumPut(STARTF_USESHOWWINDOW, &amp;STARTUPINFO + 4*A_PtrSize + 7*4))
   NumPut(ShowWindow, &amp;STARTUPINFO + 4*A_PtrSize + 8*4)
   
   VarSetCapacity(PROCESS_INFORMATION, 2*A_PtrSize + 8, 0)
   
   DllCall(&quot;CreateProcess&quot;, Ptr, 0, Str, CommandLine
                          , Ptr, 0, Ptr, 0
                          , Int, bInheritHandles := 0, UInt, flag, Ptr, 0, Ptr, 0
                          , Ptr, &amp;STARTUPINFO, Ptr, &amp;PROCESS_INFORMATION)
                          
   DllCall(&quot;CloseHandle&quot;, Ptr, hThread := NumGet(PROCESS_INFORMATION))
   DllCall(&quot;CloseHandle&quot;, Ptr, hProcess := NumGet(&amp;PROCESS_INFORMATION + A_PtrSize))
   Return PID := NumGet(&amp;PROCESS_INFORMATION + 2*A_PtrSize, &quot;UInt&quot;)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-08-22T15:46:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96751#p96751</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96750#p96750" />
			<content type="html"><![CDATA[<p>SW_SHOWDEFAULT — это тот вид окна, который указан в STARTUPINFO при создании процесса. Некоторые окна появляются свёрнутыми, некоторые — скрытыми. Например, для блокнота этот параметр равен SW_SHOW (обычный вид окна). Но тебе это никак не поможет, потому что процесс не ты создаёшь, а скомпилированный исполняемый файл приложения. С WinMain не разбирался.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-08-22T14:50:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96750#p96750</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96748#p96748" />
			<content type="html"><![CDATA[<p>В <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms633548(v=vs.85).aspx">ShowWindow</a> есть некий параметр SW_SHOWDEFAULT мне не понятный, там ещё в примечаниях что то связано с ним и <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms686331(v=vs.85).aspx">STARTUPINFO structure</a>, возможно ещё с <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms633559(v=vs.85).aspx">WinMain</a> (тоже загадочная функция).</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-08-22T14:41:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96748#p96748</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96747#p96747" />
			<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>2015-08-22T14:26:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96747#p96747</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96746#p96746" />
			<content type="html"><![CDATA[<p>Нет, не сработает, пробовал.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-08-22T14:23:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96746#p96746</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96745#p96745" />
			<content type="html"><![CDATA[<p>Применить стиль <a href="https://msdn.microsoft.com/ru-ru/library/windows/desktop/ff700543%28v=vs.85%29.aspx#WS_EX_NOACTIVATE">WS_EX_NOACTIVATE</a>?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-08-22T14:20:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96745#p96745</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96744#p96744" />
			<content type="html"><![CDATA[<p>Ясно. А идей как окно &quot;заморозить на время от активации&quot; нет? Может какая то оконная функция.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-08-22T14:13:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96744#p96744</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96743#p96743" />
			<content type="html"><![CDATA[<p>WH_CALLWNDPROC для своего процесса — это, как я понимаю, то же, что OnMessage(), так что смысла в таком хуке немного.<br />Нужный тебе ThreadId — это идентификатор ветки, создавшей окно. Получить можно так:<br /></p><div class="codebox"><pre><code>Run, notepad,,, PID
WinWait, ahk_pid %PID%
MsgBox, % ThreadId := DllCall(&quot;GetWindowThreadProcessId&quot;, Ptr, WinExist(), Ptr, 0)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-08-22T14:04:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96743#p96743</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96742#p96742" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Чтобы установить хуки, кроме WH_KEYBOARD_LL и WH_MOUSE_LL</p></blockquote></div><p>Думаю что не только, видел какие то примеры с WH_JOURNALPLAYBACK... WH_CALLWNDPROC тоже работает для ThreadId&nbsp; <a href="http://www.autohotkey.com/board/topic/27343-fade-in-effect-on-other-windows-inputboxes-fil/?p=175890">своего процесса</a>.<br /></p><div class="quotebox"><blockquote><p>Windows Store app development If dwThreadId is zero, then window hook DLLs are not loaded in-process for the Windows Store app processes and the Windows Runtime broker process unless they are installed by either UIAccess processes (accessibility tools). The notification is delivered on the installer&#039;s thread for these hooks:<br />WH_JOURNALPLAYBACK<br />WH_JOURNALRECORD <br />WH_KEYBOARD <br />WH_KEYBOARD_LL <br />WH_MOUSE <br />WH_MOUSE_LL</p></blockquote></div><div class="quotebox"><blockquote><p>всё уже давно опробовано на офф. форуме.</p></blockquote></div><p>Думаю это не гарантия невозможности.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-08-22T13:28:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96742#p96742</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96739#p96739" />
			<content type="html"><![CDATA[<p>Чтобы установить хуки, кроме WH_KEYBOARD_LL и WH_MOUSE_LL, их функция должна находиться в отдельном модуле (в dll), всё уже давно опробовано на офф. форуме. Я тоже в своё время по-всякому пробовал.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-08-22T12:54:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96739#p96739</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Запрет активации окна]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96737#p96737" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Не думаю, что в рамках AHK это возможно (перехват сообщений и winapi-функций)</p></blockquote></div><p> А ты не пробовал в SetWindowsHookEx idHook установить в WH_CALLWNDPROC, а для dwThreadId установить ThreadId нужного процесса? Я бы сам попробовал, но не могу получить ThreadId стороннего процесса. Или там ещё какие то заморочки с hMod?<br /></p><div class="quotebox"><blockquote><p>HHOOK WINAPI SetWindowsHookEx(<br />&nbsp; _In_ int&nbsp; &nbsp; &nbsp; &nbsp;idHook,<br />&nbsp; _In_ HOOKPROC&nbsp; lpfn,<br />&nbsp; _In_ HINSTANCE hMod,<br />&nbsp; _In_ DWORD&nbsp; &nbsp; &nbsp;dwThreadId<br />);</p></blockquote></div><div class="codebox"><pre><code>
CallWndProcHook := DllCall(&quot;SetWindowsHookEx&quot;
    ,&quot;int&quot;, 0x4  ; WH_CALLWNDPROC
    ,&quot;Ptr&quot;, RegisterCallback(&quot;CallWndProc&quot;)
    ,&quot;Ptr&quot;, 0
    ,&quot;UInt&quot;, ThreadId, &quot;Ptr&quot;)
     
CallWndProc(nCode, wParam, lParam) {
    global CallWndProcHook 
    Critical
    msg := NumGet(lParam+8)
    hwnd := NumGet(lParam+12)
    
    ToolTip % msg &quot;`n&quot; hwnd   
    Return DllCall(&quot;CallNextHookEx&quot;,&quot;Ptr&quot;,CallWndProcHook,&quot;Int&quot;,nCode,&quot;UInt&quot;,wParam,&quot;UInt&quot;,lParam)
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-08-22T12:21:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96737#p96737</id>
		</entry>
</feed>
