<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: получить координаты мышки как в AhkSpy]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16527&amp;type=atom" />
	<updated>2021-08-10T12:27:29Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=16527</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: получить координаты мышки как в AhkSpy]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=149220#p149220" />
			<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>2021-08-10T12:27:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=149220#p149220</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: получить координаты мышки как в AhkSpy]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=149219#p149219" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> так тоже работает, как предпочтительней? Что быстрее работает и меньше нагружает пк?</p>]]></content>
			<author>
				<name><![CDATA[OmTatSat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33453</uri>
			</author>
			<updated>2021-08-10T08:35:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=149219#p149219</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: получить координаты мышки как в AhkSpy]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=149218#p149218" />
			<content type="html"><![CDATA[<p>Эти кнопки не являются контролами. Можно так:<br /></p><div class="codebox"><pre><code>~LButton::
   CoordMode, Mouse
   MouseGetPos, X, Y
   AccObj := AccObjectFromPoint(child)
   Pos := AccLocation(AccObj, child)
   ToolTip, % &quot;X: &quot; . X - Pos.x . &quot; Y:&quot; . Y - Pos.y
   Return

AccObjectFromPoint(ByRef _idChild_ = &quot;&quot;, x = &quot;&quot;, y = &quot;&quot;) {
   static VT_DISPATCH := 9, F_OWNVALUE := 1, h := DllCall(&quot;LoadLibrary&quot;, &quot;Str&quot;, &quot;oleacc&quot;, &quot;Ptr&quot;)
   
   AccObject := 0
   (x = &quot;&quot; || y = &quot;&quot;) ? DllCall(&quot;GetCursorPos&quot;, &quot;Int64P&quot;, pt) : pt := x &amp; 0xFFFFFFFF | y &lt;&lt; 32
   VarSetCapacity(varChild, 8 + 2*A_PtrSize, 0)
   if	DllCall(&quot;oleacc\AccessibleObjectFromPoint&quot;, &quot;Int64&quot;, pt, &quot;PtrP&quot;, pAcc, &quot;Ptr&quot;, &amp;varChild) = 0
      _idChild_ := NumGet(varChild, 8, &quot;UInt&quot;), AccObject := ComObject(VT_DISPATCH, pAcc, F_OWNVALUE)
   Return AccObject
}

AccLocation(Acc, ChildId := 0, ByRef Position := &quot;&quot;) {
   static type := (VT_BYREF := 0x4000) | (VT_I4 := 3)
   try Acc.accLocation( ComObject(type, &amp;x := 0), ComObject(type, &amp;y := 0)
                      , ComObject(type, &amp;w := 0), ComObject(type, &amp;h := 0), ChildId )
   catch
      Return
   _x := NumGet(x, &quot;int&quot;), _y := NumGet(y, &quot;int&quot;), _w = NumGet(w, &quot;int&quot;), _h := NumGet(h, &quot;int&quot;)
   Position := &quot;x&quot; . _x . &quot; y&quot; . _y . &quot; w&quot; . _w . &quot; h&quot; . _h
   Return {x: _x, y: _y, w: _w, h: _h}
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-08-10T08:29:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=149218#p149218</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: получить координаты мышки как в AhkSpy]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=149217#p149217" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> спасибо ещё раз, чуть подправил ваш вариант, перешел - на ahk_id и получил то, что хотел.</p><div class="codebox"><pre><code>mButton::
   CoordMode, Mouse
   MouseGetPos, x, y,ahk_id, hCtrl, 2
   WinGetPos, xCtrl, yCtrl,,, ahk_id %ahk_id%
   ToolTip, % &quot;X: &quot; . x - xCtrl . &quot; Y:&quot; . y - yCtrl &quot;`n&quot; &quot;x:&quot; x &quot;`n&quot; &quot;xctrl:&quot; xctrl &quot;`n&quot; &quot;hCtrl:&quot; hCtrl &quot;`n&quot; &quot;ahk_id:&quot; ahk_id
   Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[OmTatSat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33453</uri>
			</author>
			<updated>2021-08-10T08:28:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=149217#p149217</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: получить координаты мышки как в AhkSpy]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=149216#p149216" />
			<content type="html"><![CDATA[<p>MouseGetPos, x, y,, hCtrl, 2</p><p>hCtrl выдаёт пустое значение над кнопками.</p>]]></content>
			<author>
				<name><![CDATA[OmTatSat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33453</uri>
			</author>
			<updated>2021-08-10T08:15:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=149216#p149216</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: получить координаты мышки как в AhkSpy]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=149215#p149215" />
			<content type="html"><![CDATA[<p>Проверил, xCtrl над кнопками выдаёт пустое значение, в другой области окна получает значение.<br />DetectHiddenWindows, on не помогает.</p>]]></content>
			<author>
				<name><![CDATA[OmTatSat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33453</uri>
			</author>
			<updated>2021-08-10T08:12:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=149215#p149215</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: получить координаты мышки как в AhkSpy]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=149214#p149214" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> да, вы правы, не полностью повторил ваш код - в тултип вывел координаты с wingetpos.<br />Если полностью повторить ваш вариант, то в тултипе пустые координаты.<br /><span class="postimg"><img src="http://forum.script-coding.com/misc.php?action=pun_attachment&amp;item=2211&amp;download=0" alt="http://forum.script-coding.com/misc.php?action=pun_attachment&amp;amp;item=2211&amp;amp;download=0" /></span></p>]]></content>
			<author>
				<name><![CDATA[OmTatSat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33453</uri>
			</author>
			<updated>2021-08-10T07:42:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=149214#p149214</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: получить координаты мышки как в AhkSpy]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=149212#p149212" />
			<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>2021-08-10T07:05:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=149212#p149212</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: получить координаты мышки как в AhkSpy]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=149211#p149211" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> Спасибо, так получил размер другой области - уже существенный прогресс, но мне нужно положение курсора мышки в этой области, чтобы знать над какой кнопкой мышка находится.</p>]]></content>
			<author>
				<name><![CDATA[OmTatSat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33453</uri>
			</author>
			<updated>2021-08-10T06:54:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=149211#p149211</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: получить координаты мышки как в AhkSpy]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=149210#p149210" />
			<content type="html"><![CDATA[<p>Попробуйте так:<br /></p><div class="codebox"><pre><code>~LButton::
   CoordMode, Mouse
   MouseGetPos, x, y,, hCtrl, 2
   WinGetPos, xCtrl, yCtrl,,, ahk_id %hCtrl%
   ToolTip, % &quot;X: &quot; . x - xCtrl . &quot; Y:&quot; . y - yCtrl
   Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2021-08-10T00:38:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=149210#p149210</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: получить координаты мышки как в AhkSpy]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=149209#p149209" />
			<content type="html"><![CDATA[<p>Здравствуйте, в окне есть 2 области с разными ahk_id, AhkSpy определяет позицию мышки в соответствии положения мышки в области.<br />Но когда я использую mousegetpos, то получаю координаты позиции в соответствии с полным размером окна.<br />CoordMode, Mouse, Client ничего не меняет. Стандартный Active Window Info также не меняет координаты для разных методов CoordMode.<br />Как получить координаты мышки как в AhkSpy а именно - как в скрине х = 25?</p><p><span class="postimg"><img src="http://forum.script-coding.com/misc.php?action=pun_attachment&amp;item=2210&amp;download=0" alt="http://forum.script-coding.com/misc.php?action=pun_attachment&amp;amp;item=2210&amp;amp;download=0" /></span></p>]]></content>
			<author>
				<name><![CDATA[OmTatSat]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33453</uri>
			</author>
			<updated>2021-08-09T23:27:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=149209#p149209</id>
		</entry>
</feed>
