<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Отследить перемещение GUI]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=17144</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17144&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Отследить перемещение GUI».]]></description>
		<lastBuildDate>Fri, 27 May 2022 17:04:00 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153365#p153365</link>
			<description><![CDATA[<p>Это отличный ответ, спасибо.</p>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Fri, 27 May 2022 17:04:00 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153365#p153365</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153364#p153364</link>
			<description><![CDATA[<p>Вот написал пример для всего сразу:<br /></p><div class="codebox"><pre><code>global exStyles := (WS_EX_COMPOSITED := 0x2000000) | (WS_EX_LAYERED := 0x80000)
     , WM_MOVE   := 0x0003
     , WM_MOVING := 0x0216
     , WS_VSCROLL := 0x00200000

Gui, New, +hwndhGui +E%exStyles%, Window position tracking
Gui, Margin, 20, 20
Gui, Font, s11, Calibri
Gui, Add, Text, w120 Right, WM_MOVE`nClient area position
Gui, Add, Edit, x+5 yp-4 w110 r2 -%WS_VSCROLL%

Gui, Add, Text, xm y+15 w120 Right, WM_MOVING`nWindow position
Gui, Add, Edit, x+5 yp-4 w110 r4 -%WS_VSCROLL%
GuiControl, Focus, Static1
Gui, Show

OnMove := Func(&quot;OnGuiMove&quot;).Bind(hGui)
OnMessage(WM_MOVE  , OnMove)
OnMessage(WM_MOVING, OnMove)

OnGuiMove(hGui, wp, lp, msg, hwnd) {
   if (hGui != hwnd)
      Return
   
   Switch msg {
      case WM_MOVE   : GuiControl,, Edit1, % &quot;x:&quot; . A_Tab . lp &amp; 0xFFFF . &quot;`n&quot;
                                           . &quot;y:&quot; . A_Tab . lp &gt;&gt; 16
                                           
      case WM_MOVING : GuiControl,, Edit2, % &quot;left:&quot;   . A_Tab . NumGet(lp +  0, &quot;Int&quot;) . &quot;`n&quot;
                                           . &quot;top:&quot;    . A_Tab . NumGet(lp +  4, &quot;Int&quot;) . &quot;`n&quot;
                                           . &quot;right:&quot;  . A_Tab . NumGet(lp +  8, &quot;Int&quot;) . &quot;`n&quot;
                                           . &quot;bottom:&quot; . A_Tab . NumGet(lp + 12, &quot;Int&quot;)
   }
}

GuiClose() {
   ExitApp
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 27 May 2022 16:50:07 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153364#p153364</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153363#p153363</link>
			<description><![CDATA[<p>Хорошо, я использовал WM_MOVING, оно срабатывает как мне нужно. Но как теперь вытащить из lParam нужные мне позиции?</p><div class="quotebox"><blockquote><p>lParam <br />A pointer to a RECT structure with the current position of the window, in screen coordinates. To change the position of the drag rectangle, an application must change the members of this structure.</p></blockquote></div><div class="codebox"><pre><code>typedef struct _RECT {
  LONG left;
  LONG top;
  LONG right;
  LONG bottom;
} RECT, *PRECT;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Fri, 27 May 2022 16:47:45 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153363#p153363</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153362#p153362</link>
			<description><![CDATA[<p>Добавляйте OnMessage после показа окна. WM_MOVE отслеживает положение клиентской области окна. Для отслеживания положения внешней рамки окна есть <a href="https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-moving">WM_MOVING</a>.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Fri, 27 May 2022 16:41:46 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153362#p153362</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153361#p153361</link>
			<description><![CDATA[<p>И я тут выяснил, что координаты можно узнать таким способом:<br /></p><div class="codebox"><pre><code>WM_MOVE(wParam, lParam)
{
	static init := OnMessage(0x3, &quot;WM_MOVE&quot;)
	static callCount := 0

	if (callCount &lt; 3)
	{
		callCount++
		return
	}

	x := lParam &amp; 0xFFFF
	y := lParam &gt;&gt; 16

	ToolTip, % x &quot; &quot; y
}</code></pre></div><p>Вот только как мне избавиться от срабатывания при инициализации.. Нормальным способом, а не тот, что я использовал.</p>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Fri, 27 May 2022 16:34:16 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153361#p153361</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153360#p153360</link>
			<description><![CDATA[<p>Но вопрос то все же в том, как оно определяет на какое именно окно реагировать?</p>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Fri, 27 May 2022 16:24:57 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153360#p153360</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153359#p153359</link>
			<description><![CDATA[<p>Хех, лишнее удаляя и его удалил, но работает и без него.</p>]]></description>
			<author><![CDATA[null@example.com (__Михаил__)]]></author>
			<pubDate>Fri, 27 May 2022 16:23:07 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153359#p153359</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153358#p153358</link>
			<description><![CDATA[<p>А где собственно используется этот хэндл в данном примере?</p>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Fri, 27 May 2022 16:19:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153358#p153358</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153357#p153357</link>
			<description><![CDATA[<p>Для этого каждому окну свой хэндл установить, в примере это есть.</p>]]></description>
			<author><![CDATA[null@example.com (__Михаил__)]]></author>
			<pubDate>Fri, 27 May 2022 16:16:49 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153357#p153357</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153356#p153356</link>
			<description><![CDATA[<p>Вчера разбирался с &quot;OnMessage&quot;, перетаскивание на лкм есть, но хотелось еще выводить контекстное меню по пкм, и вот вопрос возник.. А как оно узнает, у какого окна оно ловит &quot;события&quot;?</p>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Fri, 27 May 2022 16:13:55 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153356#p153356</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153355#p153355</link>
			<description><![CDATA[<p>Можно например так:</p><div class="codebox"><pre><code>Gui +LastFound +AlwaysOnTop +ToolWindow +hwndhGui
Gui Color, 0xDDFFAA
Gui Add, Text, vText x8 y8 w150 h23
Gui Show
WM_MOVE()
OnMessage(0x3, &quot;WM_MOVE&quot;)   ; Отслеживаем перемещения окна.
Return

GuiEscape:
GuiClose:
ExitApp

WM_MOVE(){
 global
 WinGetPos, x, y
 GuiControl,, Text, % &quot;Позиция: X: &quot; x &quot;,  Y: &quot; y
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (__Михаил__)]]></author>
			<pubDate>Fri, 27 May 2022 16:03:16 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153355#p153355</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153354#p153354</link>
			<description><![CDATA[<p>Похожая тема: <a href="https://forum.script-coding.com/viewtopic.php?id=5553">AHK: Оконтуривание рамки активного окна</a>.</p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Fri, 27 May 2022 16:03:11 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153354#p153354</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153353#p153353</link>
			<description><![CDATA[<p>Допустим сам пользователь.</p>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Fri, 27 May 2022 15:38:04 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153353#p153353</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153352#p153352</link>
			<description><![CDATA[<p>Перемещение происходит самим скриптом или его положение меняет другая программа?</p>]]></description>
			<author><![CDATA[null@example.com (__Михаил__)]]></author>
			<pubDate>Fri, 27 May 2022 15:37:09 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153352#p153352</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Отследить перемещение GUI]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=153349#p153349</link>
			<description><![CDATA[<p>Можно ли как-то нормальный способом аля &quot;хук&quot;, отследить перемещение окна GUI?</p>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Thu, 26 May 2022 23:35:34 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=153349#p153349</guid>
		</item>
	</channel>
</rss>
