<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=9799&amp;type=atom" />
	<updated>2015-09-18T19:28:33Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=9799</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=97565#p97565" />
			<content type="html"><![CDATA[<p><strong>teadrinker,</strong> Просто похожие вопросы. Думал ответ легче будет найти в этой теме.&nbsp; Наверное, будет лучше создать отдельную тему. Прошу прощения.</p>]]></content>
			<author>
				<name><![CDATA[Тимур]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=28743</uri>
			</author>
			<updated>2015-09-18T19:28:33Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=97565#p97565</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=97564#p97564" />
			<content type="html"><![CDATA[<p><strong>Тимур</strong>, а <a href="http://forum.script-coding.com/rules.html#3.11.">какое</a> отношение ваш вопрос имеет к этой теме?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2015-09-18T19:23:40Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=97564#p97564</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=97561#p97561" />
			<content type="html"><![CDATA[<p>Помогите, пожалуйста, исправить код.<br />Нужно, чтобы курсор запомнил своё текущее положение, переместился в определенных экранных координатах, нажал правую кнопку мыши и вернулся в исходное положение.<br />Но при этом хотелось бы иметь возможность физически управлять перемещением мыши, а скрипт независимо от этого выполнял свою функцию.<br />Нижеприведенный код работает, только если не управлять мышью физически.</p><div class="codebox"><pre><code>sy:= A_ScreenHeight*(990/1024)
sx:= A_ScreenWidth*(30/1280)
MouseGetPos x, y
MouseClick R, %sx%, %sy%, 1, 0
MouseMove %x%, %y%, 0</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Тимур]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=28743</uri>
			</author>
			<updated>2015-09-18T18:07:09Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=97561#p97561</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=85002#p85002" />
			<content type="html"><![CDATA[<p><a href="http://forum.script-coding.com/viewtopic.php?id=6148">Обновите AHK</a>.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-07-22T16:15:30Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=85002#p85002</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=85000#p85000" />
			<content type="html"><![CDATA[<p>Добрый день. </p><div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Курсор должен быть перемещён в точку (500, 500) в экранных координатах. А у вас что получается?</p></blockquote></div><p>Ничего не происходит.</p>]]></content>
			<author>
				<name><![CDATA[S.shipilov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=30244</uri>
			</author>
			<updated>2014-07-22T15:52:45Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=85000#p85000</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=84783#p84783" />
			<content type="html"><![CDATA[<p>Курсор должен быть перемещён в точку (500, 500) в экранных координатах. А у вас что получается?</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-07-15T12:37:37Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=84783#p84783</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=84782#p84782" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><div class="codebox"><pre><code>API_SendInputMouse(500, 500)

API_SendInputMouse(x, y)
{
   static INPUT_MOUSE := 0, MOUSEEVENTF_ABSOLUTE := 0x8000, MOUSEEVENTF_MOVE := 1
   
   VarSetCapacity(INPUT, SizeOfINPUT := A_PtrSize + 4*4 + 2*A_PtrSize)
   NumPut(INPUT_MOUSE, INPUT, &quot;UInt&quot;)
   NumPut(Round(x/A_ScreenWidth*0xFFFF), INPUT, A_PtrSize, &quot;UInt&quot;)
   NumPut(Round(y/A_ScreenHeight*0xFFFF), INPUT, A_PtrSize + 4, &quot;UInt&quot;)
   NumPut(0, INPUT, A_PtrSize + 4*2, &quot;UInt&quot;)
   NumPut(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, INPUT, A_PtrSize + 4*3, &quot;UInt&quot;)
   NumPut(0, INPUT, A_PtrSize + 4*4, &quot;UInt&quot;)
   NumPut(0, INPUT, A_PtrSize + 4*4 + A_PtrSize)
   
   DllCall(&quot;SendInput&quot;, UInt, 1, Ptr, &amp;INPUT, Int, SizeOfINPUT)
}</code></pre></div></blockquote></div><p>прошу прощения, но каков должен быть результат запуска данного кода?</p>]]></content>
			<author>
				<name><![CDATA[S.shipilov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=30244</uri>
			</author>
			<updated>2014-07-15T12:24:22Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=84782#p84782</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=84774#p84774" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>API_SendInputMouse(500, 500)

API_SendInputMouse(x, y)
{
   static INPUT_MOUSE := 0, MOUSEEVENTF_ABSOLUTE := 0x8000, MOUSEEVENTF_MOVE := 1
   
   VarSetCapacity(INPUT, SizeOfINPUT := A_PtrSize + 4*4 + 2*A_PtrSize)
   NumPut(INPUT_MOUSE, INPUT, &quot;UInt&quot;)
   NumPut(Round(x/A_ScreenWidth*0xFFFF), INPUT, A_PtrSize, &quot;UInt&quot;)
   NumPut(Round(y/A_ScreenHeight*0xFFFF), INPUT, A_PtrSize + 4, &quot;UInt&quot;)
   NumPut(0, INPUT, A_PtrSize + 4*2, &quot;UInt&quot;)
   NumPut(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, INPUT, A_PtrSize + 4*3, &quot;UInt&quot;)
   NumPut(0, INPUT, A_PtrSize + 4*4, &quot;UInt&quot;)
   NumPut(0, INPUT, A_PtrSize + 4*4 + A_PtrSize)
   
   DllCall(&quot;SendInput&quot;, UInt, 1, Ptr, &amp;INPUT, Int, SizeOfINPUT)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-07-14T21:37:43Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=84774#p84774</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=84767#p84767" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Winapi функция SendInput также не предоставляет возможности управления скоростью перемещения курсора между двумя точками.</p></blockquote></div><p>Спасибо. Далее вопрос имеет сугубо академический характер нежели практический поскольку основное пожелание к работе с Winapi&nbsp; функцией SendInput не выполнимо.</p>]]></content>
			<author>
				<name><![CDATA[S.shipilov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=30244</uri>
			</author>
			<updated>2014-07-14T13:24:36Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=84767#p84767</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=84731#p84731" />
			<content type="html"><![CDATA[<p>Вывод: winapi функции mouse_event и SendInput с указанием относительных координат не годятся для цели, обозначенной ТС.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-07-12T15:41:17Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=84731#p84731</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=84730#p84730" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> тяжело для не окрепшей психики, можешь выводы привести, а то не даётся...</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-07-12T15:11:59Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=84730#p84730</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=84727#p84727" />
			<content type="html"><![CDATA[<p>Функция mouse_event используется для интерпретации движений мыши. Можно провести такой эксперимент. Установим курсор примерно в центр экрана возле какой-либо точки, от которой можно вести отсчёт. Теперь сдвинем мышь (не курсор, а именно мышь) влево на сантиметр, но не сразу, а маленькими отдельными движениями. Курсор сдвигается влево на определённое расстояние, зависящее от системных настроек скорости мыши. Теперь сдвинем мышь (не курсор, а именно мышь) на то же расстояние вправо, только одним быстрым движением. Курсор не вернётся в исходную точку, а переместится гораздо правее. Вот <a href="http://msdn.microsoft.com/en-us/library/aa227574%28v=vs.60%29.aspx">здесь</a> описан алгоритм расчёта движения курсора.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-07-12T14:28:12Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=84727#p84727</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=84724#p84724" />
			<content type="html"><![CDATA[<p>Как-то странно ведет себя <em>DllCall(&quot;mouse_event&quot;...</em><br />Если заменить на <em>SendEvent</em>, как предложил <strong>serzh82saratov</strong>, то при абсолютно том же алгоритме результат получается корректным.</p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2014-07-12T14:07:18Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=84724#p84724</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=84722#p84722" />
			<content type="html"><![CDATA[<p><strong>Irbis</strong>:<br /></p><div class="codebox"><pre><code>F1::
MouseMove, 100, 600
Sleep, 1000

mouseXY(100,-100,10)
MouseGetPos, X1, Y1
Sleep, 1000

mouseXY(100,-100, 1000)
MouseGetPos, X2, Y2

MsgBox, % &quot;Пройденный путь 1: &quot; Round(((X1 - 100)**2 + (Y1 + (-600))**2)**0.5)
      . &quot;`nПройденный путь 2: &quot; Round(((X2 - X1)**2 + (Y2 + (-Y1))**2)**0.5)
Return

mouseXY(x,y,s) 
{
   dx:=0,dy:=0, dx0:=0, dy0:=0
   loop % s
   {
      DllCall(&quot;mouse_event&quot;,uint,1,int
              ,dx0:=Round(dx := dx+x/s - dx0),int
              ,dy0:=Round(dy := dy+y/s - dy0),uint,0,int,0) 
   }
}</code></pre></div><p><img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-07-12T12:40:59Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=84722#p84722</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:[Dllcall] Вопрос по синтаксису Dllcall ("Sendinput"...)]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=84721#p84721" />
			<content type="html"><![CDATA[<p>Тогда уж и DllCall упразднить.<br /></p><div class="codebox"><pre><code>
SetBatchLines -1 

1:: 
    mouseXY(1111,-555,111) 
    Return

mouseXY(x,y,s)  {
    Loop % s + (dx:=dy:=dx0:=dy0:=0)
        SendEvent % &quot;{Click, &quot; (dx0:=Round(dx:=dx+x/s-dx0)) &quot;,&quot; 
            . (dy0:=Round(dy:=dy+y/s-dy0)) &quot;, 0, Rel}&quot;
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-07-12T12:32:00Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=84721#p84721</id>
		</entry>
</feed>
