<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; АНК: Закрыть незакрываемое окно]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9736&amp;type=atom" />
	<updated>2014-06-26T02:17:40Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9736</id>
		<entry>
			<title type="html"><![CDATA[Re: АНК: Закрыть незакрываемое окно]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84218#p84218" />
			<content type="html"><![CDATA[<p>Внедряться тогда в процесс и выполнять там свой код, подставив свой обработчик для сообщений окна. Опять же, думаю, не будет универсальности. Например, для инжекта DLL надо знать адрес функции LoadLibrary, но из-за ASLR он может быть другим в другом процессе. Может, его можно скорректировать, узнав адрес загрузки kernel32.dll в тот процесс. Если рандомизация не идёт ещё дальше.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2014-06-26T02:17:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84218#p84218</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: АНК: Закрыть незакрываемое окно]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84216#p84216" />
			<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-25T21:36:37Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84216#p84216</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: АНК: Закрыть незакрываемое окно]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84214#p84214" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Тогда так можно наудачу попробовать:<br /></p><div class="codebox"><pre><code>F10::
   ThreadID := DllCall(&quot;GetWindowThreadProcessId&quot;, Ptr, WinExist(&quot;A&quot;), Ptr, 0)
   hThread := DllCall(&quot;OpenThread&quot;, UInt, THREAD_TERMINATE := 1, UInt, 0, UInt, ThreadID, Ptr)
   DllCall(&quot;TerminateThread&quot;, Ptr, hThread, UInt, 0)
   DllCall(&quot;CloseHandle&quot;, Ptr, hThread)
   Return</code></pre></div></blockquote></div><p>убило вообще все окна тимвьюера, но процессы продолжили жить.</p>]]></content>
			<author>
				<name><![CDATA[Drugoy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27463</uri>
			</author>
			<updated>2014-06-25T20:19:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84214#p84214</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: АНК: Закрыть незакрываемое окно]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84206#p84206" />
			<content type="html"><![CDATA[<p>Тогда так можно наудачу попробовать:<br /></p><div class="codebox"><pre><code>F10::
   ThreadID := DllCall(&quot;GetWindowThreadProcessId&quot;, Ptr, WinExist(&quot;A&quot;), Ptr, 0)
   hThread := DllCall(&quot;OpenThread&quot;, UInt, THREAD_TERMINATE := 1, UInt, 0, UInt, ThreadID, Ptr)
   DllCall(&quot;TerminateThread&quot;, Ptr, hThread, UInt, 0)
   DllCall(&quot;CloseHandle&quot;, Ptr, hThread)
   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-25T18:06:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84206#p84206</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: АНК: Закрыть незакрываемое окно]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84197#p84197" />
			<content type="html"><![CDATA[<p>Достаточно закрыть поток, создавший окно, по идее, если приложение многопоточное. Конечно, вопрос, к чему это приведёт в смысле функционала программы.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2014-06-25T17:13:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84197#p84197</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: АНК: Закрыть незакрываемое окно]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84187#p84187" />
			<content type="html"><![CDATA[<p>Ну ещё <a href="http://msdn.microsoft.com/en-us/library/ms632682%28v=vs.85%29.aspx">DestroyWindow function</a>. Хотя скорее всего, все подобные сообщения просто перехватываются. В этом случае закрыть не получится никак без завершения процесса, можно только скрыть.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-06-25T15:20:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84187#p84187</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: АНК: Закрыть незакрываемое окно]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84186#p84186" />
			<content type="html"><![CDATA[<p>Да, здесь актуально было бы сослаться на MessageList: http://script-coding.com/AutoHotkey/MessageList.html<br /></p><div class="codebox"><pre><code>WM_CLOSE = 0x10
WM_QUIT = 0x12</code></pre></div><p>Попробовал WM_DESTROY - не помогло.</p>]]></content>
			<author>
				<name><![CDATA[Drugoy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27463</uri>
			</author>
			<updated>2014-06-25T15:18:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84186#p84186</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: АНК: Закрыть незакрываемое окно]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84183#p84183" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Drugoy пишет:</cite><blockquote><p>PostMessage,0x10<br />PostMessage,0x12</p></blockquote></div><p>Знать бы ещё, что это за <a href="http://ru.wikipedia.org/wiki/%D0%9C%D0%B0%D0%B3%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%BE%D0%B5_%D1%87%D0%B8%D1%81%D0%BB%D0%BE_%28%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5%29">магические числа</a>.<br /><a href="http://msdn.microsoft.com/en-us/library/ms632620%28v=vs.85%29.aspx"><strong>WM_DESTROY</strong></a> можно попробовать.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-06-25T14:56:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84183#p84183</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[АНК: Закрыть незакрываемое окно]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=84182#p84182" />
			<content type="html"><![CDATA[<p>Как закрыть окно, не реагирующее на WinClose, WinKill и PostMessage,0x10?<br />Убивать родительский процесс - не выход, т.к. процесс помимо этого окна хостит и полезные окна.<br />Скрывать окно - не подходит, т.к. оно будет оставаться в системе (сейчас я его скрываю, но мне бы хотелось от этого уйти).</p><p>Пример такого окна - после завершения сессии в бесплатной версии TeamViewer на той машине, к которой подключались вылезает окно с WinTitle &quot;Спонсируемый сеанс ahk_class #32770 ahk_exe TeamViewer.exe&quot;.</p><p>У этого окна используются нестандартные стили (style 0x94C000CE и exstyle 0x00010109), которые я пробовал приводить к стандартному виду (к 0x14CF0000 и 0x00000100, как у окон проводника), появляется в заголовке кнопка закрытия окна, но клик по ней ничего не делает.</p><p>Alt+F4 также не закрывает окно.</p><p>Окно, по задумке разработчиков программы закрывается при клике по одной из кнопок внутри окна (кнопка &quot;ОК&quot;) и окно можно закрыть используя ControlClick или ControlSend для эмуляции клика по этой кнопке, но этот вариант - очень частный, а хочется более универсального решения (в принципе, разработчиком же ничто не мешало скрыть эту кнопку или вовсе не создавать в окне никаких кнопок) по закрытию окна.</p><p>Один человек в IRC заявил, что у него это окно удалось закрыть командой PostMessage,0x10, но у меня этот вариант не сработал, а PostMessage,0x12 закрывает все окна (а процесс после этого умирает).</p>]]></content>
			<author>
				<name><![CDATA[Drugoy]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27463</uri>
			</author>
			<updated>2014-06-25T14:41:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=84182#p84182</id>
		</entry>
</feed>
