<?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=8609&amp;type=atom" />
	<updated>2017-05-08T06:57:53Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=8609</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115743#p115743" />
			<content type="html"><![CDATA[<p>Читайте русскую справку по GUI.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2017-05-08T06:57:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115743#p115743</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115730#p115730" />
			<content type="html"><![CDATA[<p>Сейчас начал делать. Возникла проблема: чтобы создать полосу прогресса я вызываю Gui show, но это меньшая из проблем. Большая это та, что при загрузке скрипта, когда полоса загрузки доходит до конца, GUI не исчезает, а при этом появляется основное GUI скрипта, и они сливаются вместе. Можно как-то закрыть первое gui?</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2017-05-07T19:40:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115730#p115730</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115708#p115708" />
			<content type="html"><![CDATA[<p><strong>ypppu</strong>, частично это решает мою проблему. Спасибо. Но, хотелось бы чтобы строчка заполнялась автоматически по мере прохождения кода, либо вот эта картинка, что крутится (которая в первом посту описана), крутилась пока скрипт не пройдет нужный кусок кода.</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2017-05-07T10:11:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115708#p115708</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115707#p115707" />
			<content type="html"><![CDATA[<p>Можно так. Должны быть какие-то признаки, по которым Вы узнаёте, на какой стадии находится выполняемая операция.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2017-05-07T10:06:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115707#p115707</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115706#p115706" />
			<content type="html"><![CDATA[<p><strong>ypppu</strong>, если я правильно понял, мне нужно будет самостоятельно расставить GuiControl,, Progress, +n (где n - любое число) в нужной части кода, предварительно выведя progress на экран, верно?</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2017-05-07T09:58:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115706#p115706</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115701#p115701" />
			<content type="html"><![CDATA[<p>Специально для этого существует элемент управления Progress (индикатор прогресса).</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2017-05-07T08:51:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115701#p115701</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=115698#p115698" />
			<content type="html"><![CDATA[<p>Здравствуйте. Имеется скрипт в котором до запуска основного GUI (с которым и работает пользователь) происходят проверка обновлений, целостности, чтение конфигураций и прочее. Возможно ли этот процесс весь как-то красиво вывести на экран в виде полосы загрузки или чего-то в этом роде, используя этот пример?</p>]]></content>
			<author>
				<name><![CDATA[belyankin12]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34408</uri>
			</author>
			<updated>2017-05-07T08:16:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=115698#p115698</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78997#p78997" />
			<content type="html"><![CDATA[<p>Спасибо&nbsp; попробую!</p>]]></content>
			<author>
				<name><![CDATA[Zanoza]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26155</uri>
			</author>
			<updated>2014-01-07T18:38:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78997#p78997</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78994#p78994" />
			<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-01-07T16:44:07Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78994#p78994</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78993#p78993" />
			<content type="html"><![CDATA[<p>Скажите - может я не тот компилятор использую (В моем варианте можно компилировать только файл - но не папку)</p>]]></content>
			<author>
				<name><![CDATA[Zanoza]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26155</uri>
			</author>
			<updated>2014-01-07T16:40:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78993#p78993</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78976#p78976" />
			<content type="html"><![CDATA[<p>Если планируется запускать скрипт на машинах, где AHK не установлен, нужно добавить в секцию автовыполнения команду</p><div class="codebox"><pre><code>FileInstall, AutoHotkeyU32.exe, %A_ScriptDir%\AutoHotkey.exe, 0</code></pre></div><p>и этом случае такой вариант функции использовать:<br /></p><div class="codebox"><pre><code>/*
;            Пример использования
            
^1::Waiting() ; запуск по умолчанию для демонстрации

; запуск двух экземпляров одновременно с блокнотом, как окном-владельцем,
; картинки будут перемещаться вместе с окном блокнота.
; при закрытии окна-владельца процессы картинок завершатся.
^2::
   DetectHiddenWindows, On
   Run, notepad.exe,, hide, PID
   WinWait, ahk_pid %PID%
   WinMove,,, (A_ScreenWidth - 400)//2, 100, 400, 300
   WinShow
   hParent := WinExist()
   
   PID1 := Waiting(&quot;&quot;, 130, 160, 50, 11, 10, 0xCCFFBE00, 10, hParent)
   PID2 := Waiting(&quot;&quot;, 260, 160, 100, 22, 10, 0xCC5A5192, 6, hParent)
   return

^3::Waiting(PID2)   ; завершаем процесс с идентификатором PID2

; Прикольно :)
^4::Waiting(&quot;&quot;, A_ScreenWidth//2, A_ScreenHeight//2, d := A_ScreenHeight - 100, d//4, 10, 0xCCFFBE00, 5)

^Space::Waiting(0)  ; закрываем все созданные процессы, передавая в функцию 0

Esc::ExitApp
return
*/

Waiting(PID=&quot;&quot;, x=&quot;&quot;, y=&quot;&quot;, Diameter=70, d=17, Number=9, Color=0xCC70A0D0, Speed=5, hParent=&quot;&quot;)
{
/*
PID — если пустое значение — запускается новый процесс,
           если числовое значекние — закрывается процесс с данным идентификатором
           если 0 — закрываются все процессы, запущенные функцией
x, y — координаты центра вращения, если в параметре hParent указан хэндл
           окна-владельца — считаются от его верхнего левого угла, иначе — относительно экрана
Diameter — общий диаметр изображения
d — диаметр элемента изображения
Number — количество элементов
Color — прозрачность и цвет изображения в формате 0xFFFFFFFF,
           где старший байт — прозрачность, остальные — цвет в RGB
Speed — скорость вращения изображения от 0 до 10
hParent — хэндл окна-владельца, если не указан, картинка будет AlwaysOnTop

Функция возвращает PID запущенного процесса.
*/

   static Waiting := new Waiting_Graphics
   (x = &quot;&quot;) ? x := A_ScreenWidth//2
   (y = &quot;&quot;) ? y := A_ScreenHeight//2
   if (PID = &quot;&quot;)
      Return Waiting.RunScript(x, y, Diameter, d, Number, Color, Speed, hParent)
   else
      Waiting.TerminateScript(PID)
}

class Waiting_Graphics
{
   __New()
   {
      this.PIDs := []
   }
   
   __Delete()
   {
      for k,v in this.PIDs
         this.PostMessageToMainWindow(v)
   }
   
   RunScript(x, y, Diameter, d, Number, Color, Speed, hWnd)
   {
      VarSetCapacity(TmpFilePath, (MAX_PATH := 260)*(A_IsUnicode ? 2 : 1))
      DllCall(&quot;GetTempFileName&quot; . (A_IsUnicode ? &quot;W&quot; : &quot;A&quot;), Str, A_Temp, Str, &quot;Wtg&quot;, UInt, 0, Ptr, &amp;TmpFilePath)
      VarSetCapacity(TmpFilePath, -1)
      FileAppend, % this.GetScript(x, y, Diameter, d, Number, Color, Speed, hWnd), % TmpFilePath
      Run, % (A_AhkPath ? A_AhkPath : A_ScriptDir . &quot;\AutoHotkey.exe&quot;) . &quot; &quot;&quot;&quot; . TmpFilePath . &quot;&quot;&quot;&quot;,,, PID
      DetectHiddenWindows, On
      WinWait, % &quot;ahk_pid&quot; PID
      FileDelete, % TmpFilePath
      this.PIDs.Insert(PID)
      Return PID
   }

   TerminateScript(PID)
   {
      if PID
      {
         this.PostMessageToMainWindow(PID)
         for k,v in this.PIDs
            if (v = PID)
               this.PIDs.Remove(k)
      }
      else
      {
         for k,v in this.PIDs
            this.PostMessageToMainWindow(v)
         this.PIDs := []
      }
   }
   
   PostMessageToMainWindow(PID)
   {
      DetectHiddenWindows, On
      SetTitleMatchMode, 2
      PostMessage, DllCall(&quot;RegisterWindowMessage&quot;, Str, &quot;WM_INFO&quot;),,,, % &quot;AutoHotkey ahk_pid &quot; PID
   }

   GetScript(x, y, Diameter, d, Number, Color, Speed, hWnd)
   {
      Script =
      (
         #NoTrayIcon
         SetBatchLines, -1
         TimePeriod = 3
         DllCall(&quot;Winmm\timeBeginPeriod&quot;, UInt, TimePeriod) 
         OnExit, Exit
         
         x := %x%, y := %y%
         Color := %Color% &amp; 0xFFFFFF
         _trans := %Color%&gt;&gt;24
         
         Number := %Number%
         Width := %Diameter%
         _Width := %d%
         dW := _Width/Number
         Speed := (%Speed% &gt; 10 ? 10 : %Speed%)
         hParent := %hWnd%
         
         R := Width//2 - _Width//2
         xR := yR := Width//2
         pi := 3.141593

         ; WS_EX_LAYERED := 0x80000, WS_EX_TRANSPARENT := 0x20
         Gui, `% &quot;-Caption +E0x80020 +hwndID +ToolWindow &quot; (hParent ? &quot;+Owner&quot; hParent : &quot;+AlwaysOnTop&quot;)
         Gui, Show, NA
         OnMessage(DllCall(&quot;RegisterWindowMessage&quot;, Str, &quot;WM_INFO&quot;), &quot;WM_INFO_RECEIVER&quot;)

         pToken := GdipStartup()

         hbm := CreateDIBSection(Width+1, Width+1)
         hdc := CreateCompatibleDC()
         obm := SelectObject(hdc, hbm)
         G := GraphicsFromHDC(hdc)
         SetSmoothingMode(G, 4)

         i := 0, Angle := pi/2 - 2*pi/Number
         Time := Round(65 - Speed*(Speed &lt; 8 ? 5 : 4.4))

         Loop
         {
            Angle += 2*pi/Number
            i := i &lt; Number ? ++i : Number
            Loop 10
            {
               trans := _trans - (A_Index - 1)*2 + (dTrans := 20)
               Width_ := _Width - 0.1*dW*(A_Index - 1) + dW
               
               GraphicsClear(G)
               Loop `% i
               {
                  _Angle := Angle - (A_Index-1)*2*pi/Number
                  trans := (t := trans - dTrans) &lt; 0 ? 0 : t
                  pBrush := BrushCreateSolid(trans&lt;&lt;24|Color)
                  if ( Width_ -= dW) &gt; 0
                     FillEllipse(G, pBrush, Round(xR - Cos(_Angle)*R)- (Width_/2)
                        , Round(yR - Sin(_Angle)*R)- (Width_/2), Width_, Width_)
                  DllCall(&quot;gdiplus\GdipDeleteBrush&quot;, &quot;ptr&quot;, pBrush)
               }
               
               if hParent
               {
                  WinGetPos, xp, yp,,, ahk_id `%hParent`%
                  if (xp = &quot;&quot;)
                     ExitApp
                  _x := xp + x, _y := yp + y
               }
               else
                  _x := x, _y := y
               UpdateLayeredWindow(ID, hdc, _x-Width//2, _y-Width//2, Width+1, Width+1)
               DllCall(&quot;Sleep&quot;, UInt, Time//10)
            }
            if (Angle &gt; pi*2)
               Angle -= pi*2
            DllCall(&quot;Sleep&quot;, UInt, Time)
         }
         return
         
         GuiClose:
            ExitApp

         Exit:
            SelectObject(hdc, obm), DllCall(&quot;DeleteObject&quot;, &quot;ptr&quot;, hbm)
            DllCall(&quot;DeleteDC&quot;, &quot;ptr&quot;, hdc), DllCall(&quot;gdiplus\GdipDeleteGraphics&quot;, &quot;ptr&quot;, G)
            GdipShutdown(pToken), pToken := &quot;&quot;
            DllCall(&quot;Winmm\timeEndPeriod&quot;, UInt, TimePeriod)
            ExitApp
            
         WM_INFO_RECEIVER()
         {
            ExitApp
         }
            
         GdipStartup()
         {
            if !DllCall(&quot;GetModuleHandle&quot;, &quot;str&quot;, &quot;gdiplus&quot;, &quot;ptr&quot;)
               DllCall(&quot;LoadLibrary&quot;, &quot;str&quot;, &quot;gdiplus&quot;)
            VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
            DllCall(&quot;gdiplus\GdiplusStartup&quot;, &quot;uptr*&quot;, pToken, &quot;ptr&quot;, &amp;si, &quot;ptr&quot;, 0)
            return pToken
         }

         GdipShutdown(pToken)
         {
            DllCall(&quot;gdiplus\GdiplusShutdown&quot;, &quot;uptr&quot;, pToken)
            if hModule := DllCall(&quot;GetModuleHandle&quot;, &quot;str&quot;, &quot;gdiplus&quot;, &quot;ptr&quot;)
               DllCall(&quot;FreeLibrary&quot;, &quot;ptr&quot;, hModule)
            return 0
         }

         CreateDIBSection(w, h, bpp=32, ByRef ppvBits=0)
         {
            hdc := DllCall(&quot;GetDC&quot;, &quot;ptr&quot;, 0, &quot;ptr&quot;)
            VarSetCapacity(bi, 40, 0)
            NumPut(w, bi, 4, &quot;uint&quot;), NumPut(h, bi, 8, &quot;uint&quot;), NumPut(40, bi, 0, &quot;uint&quot;)
               , NumPut(1, bi, 12, &quot;ushort&quot;), NumPut(0, bi, 16), NumPut(bpp, bi, 14, &quot;ushort&quot;)
            hbm := DllCall(&quot;CreateDIBSection&quot;, &quot;ptr&quot; , hdc, &quot;ptr&quot; , &amp;bi
               , &quot;uint&quot; , 0, &quot;ptr*&quot;, ppvBits, &quot;ptr&quot; , 0, &quot;uint&quot; , 0, &quot;ptr&quot;)

            DllCall(&quot;ReleaseDC&quot;, &quot;ptr&quot;, 0, &quot;ptr&quot;, hdc)
            return hbm
         }

         CreateCompatibleDC(hdc=0)
         {
            return DllCall(&quot;CreateCompatibleDC&quot;, &quot;ptr&quot;, hdc, &quot;ptr&quot;)
         }

         SelectObject(hdc, hgdiobj)
         {
            return DllCall(&quot;SelectObject&quot;, &quot;ptr&quot;, hdc, &quot;ptr&quot;, hgdiobj, &quot;ptr&quot;)
         }

         GraphicsFromHDC(hdc)
         {
             DllCall(&quot;gdiplus\GdipCreateFromHDC&quot;, &quot;ptr&quot;, hdc, &quot;ptr*&quot;, pGraphics)
             return pGraphics
         }

         SetSmoothingMode(pGraphics, SmoothingMode)
         {
            return DllCall(&quot;gdiplus\GdipSetSmoothingMode&quot;, &quot;ptr&quot;, pGraphics, &quot;int&quot;, SmoothingMode)
         }

         GraphicsClear(pGraphics, ARGB=0x00ffffff)
         {
             return DllCall(&quot;gdiplus\GdipGraphicsClear&quot;, &quot;ptr&quot;, pGraphics, &quot;uint&quot;, ARGB)
         }

         BrushCreateSolid(ARGB=0xff000000)
         {
            DllCall(&quot;gdiplus\GdipCreateSolidFill&quot;, &quot;uint&quot;, ARGB, &quot;ptr*&quot;, pBrush)
            return pBrush
         }

         FillEllipse(pGraphics, pBrush, x, y, w, h)
         {
            return DllCall(&quot;gdiplus\GdipFillEllipse&quot;, &quot;ptr&quot;, pGraphics, &quot;ptr&quot;, pBrush, &quot;float&quot;, x, &quot;float&quot;, y, &quot;float&quot;, w, &quot;float&quot;, h)
         }

         UpdateLayeredWindow(hwnd, hdc, x=&quot;&quot;, y=&quot;&quot;, w=&quot;&quot;, h=&quot;&quot;, Alpha=255)
         {
            if ((x != &quot;&quot;) &amp;&amp; (y != &quot;&quot;))
               VarSetCapacity(pt, 8), NumPut(x, pt, 0, &quot;uint&quot;), NumPut(y, pt, 4, &quot;uint&quot;)

            if (w = &quot;&quot;) ||(h = &quot;&quot;)
               WinGetPos,,, w, h, ahk_id `%hwnd`%
            
            return DllCall(&quot;UpdateLayeredWindow&quot;, &quot;ptr&quot;, hwnd, &quot;ptr&quot;, 0, &quot;ptr&quot;, ((x = &quot;&quot;) &amp;&amp; (y = &quot;&quot;)) ? 0 : &amp;pt
            , &quot;int64*&quot;, w|h&lt;&lt;32, &quot;ptr&quot;, hdc, &quot;int64*&quot;, 0, &quot;uint&quot;, 0, &quot;uint*&quot;, Alpha&lt;&lt;16|1&lt;&lt;24, &quot;uint&quot;, 2)
         }
      )
      return Script
   }
}</code></pre></div><p>Перед компиляцией добавить в папку скрипта файл AutoHotkeyU32.exe из директории AHK, компилировать в Unicode 32-bit.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-01-07T05:40:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78976#p78976</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78974#p78974" />
			<content type="html"><![CDATA[<p>&gt;&gt;&gt;&nbsp; с помощью FileInstall и вместо A_AhkPath подставлять путь к нему.<br />Не могу понять как задать путь ?<br />Подскажите пожалуйста</p>]]></content>
			<author>
				<name><![CDATA[Zanoza]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26155</uri>
			</author>
			<updated>2014-01-07T04:35:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78974#p78974</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78582#p78582" />
			<content type="html"><![CDATA[<p>Попробуйте так (заодно баг один исправлен):<br /></p><div class="codebox"><pre><code>/*
;            Пример использования
            
^1::Waiting() ; запуск по умолчанию для демонстрации

; запуск двух экземпляров одновременно с блокнотом, как окном-владельцем,
; картинки будут перемещаться вместе с окном блокнота.
; при закрытии окна-владельца процессы картинок завершатся.
^2::
   DetectHiddenWindows, On
   Run, notepad.exe,, hide, PID
   WinWait, ahk_pid %PID%
   WinMove,,, (A_ScreenWidth - 400)//2, 100, 400, 300
   WinShow
   hParent := WinExist()
   
   PID1 := Waiting(&quot;&quot;, 130, 160, 50, 11, 10, 0xCCFFBE00, 10, hParent)
   PID2 := Waiting(&quot;&quot;, 260, 160, 100, 22, 10, 0xCC5A5192, 6, hParent)
   return

^3::Waiting(PID2)   ; завершаем процесс с идентификатором PID2

; Прикольно :)
^4::Waiting(&quot;&quot;, A_ScreenWidth//2, A_ScreenHeight//2, d := A_ScreenHeight - 100, d//4, 10, 0xCCFFBE00, 5)

^Space::Waiting(0)  ; закрываем все созданные процессы, передавая в функцию 0

Esc::ExitApp
return
*/

Waiting(PID=&quot;&quot;, x=&quot;&quot;, y=&quot;&quot;, Diameter=70, d=17, Number=9, Color=0xCC70A0D0, Speed=5, hParent=&quot;&quot;)
{
/*
PID — если пустое значение — запускается новый процесс,
           если числовое значекние — закрывается процесс с данным идентификатором
           если 0 — закрываются все процессы, запущенные функцией
x, y — координаты центра вращения, если в параметре hParent указан хэндл
           окна-владельца — считаются от его верхнего левого угла, иначе — относительно экрана
Diameter — общий диаметр изображения
d — диаметр элемента изображения
Number — количество элементов
Color — прозрачность и цвет изображения в формате 0xFFFFFFFF,
           где старший байт — прозрачность, остальные — цвет в RGB
Speed — скорость вращения изображения от 0 до 10
hParent — хэндл окна-владельца, если не указан, картинка будет AlwaysOnTop

Функция возвращает PID запущенного процесса.
*/

   static Waiting := new Waiting_Graphics
   (x = &quot;&quot;) ? x := A_ScreenWidth//2
   (y = &quot;&quot;) ? y := A_ScreenHeight//2
   if (PID = &quot;&quot;)
      Return Waiting.RunScript(x, y, Diameter, d, Number, Color, Speed, hParent)
   else
      Waiting.TerminateScript(PID)
}

class Waiting_Graphics
{
   __New()
   {
      this.PIDs := []
   }
   
   __Delete()
   {
      for k,v in this.PIDs
         this.PostMessageToMainWindow(v)
   }
   
   RunScript(x, y, Diameter, d, Number, Color, Speed, hWnd)
   {
      VarSetCapacity(TmpFilePath, (MAX_PATH := 260)*(A_IsUnicode ? 2 : 1))
      DllCall(&quot;GetTempFileName&quot; . (A_IsUnicode ? &quot;W&quot; : &quot;A&quot;), Str, A_Temp, Str, &quot;Wtg&quot;, UInt, 0, Ptr, &amp;TmpFilePath)
      VarSetCapacity(TmpFilePath, -1)
      FileAppend, % this.GetScript(x, y, Diameter, d, Number, Color, Speed, hWnd), % TmpFilePath
      Run, % A_AhkPath &quot; &quot;&quot;&quot; TmpFilePath &quot;&quot;&quot;&quot;,,, PID
      DetectHiddenWindows, On
      WinWait, % &quot;ahk_pid&quot; PID
      FileDelete, % TmpFilePath
      this.PIDs.Insert(PID)
      Return PID
   }

   TerminateScript(PID)
   {
      if PID
      {
         this.PostMessageToMainWindow(PID)
         for k,v in this.PIDs
            if (v = PID)
               this.PIDs.Remove(k)
      }
      else
      {
         for k,v in this.PIDs
            this.PostMessageToMainWindow(v)
         this.PIDs := []
      }
   }
   
   PostMessageToMainWindow(PID)
   {
      DetectHiddenWindows, On
      SetTitleMatchMode, 2
      PostMessage, DllCall(&quot;RegisterWindowMessage&quot;, Str, &quot;WM_INFO&quot;),,,, % &quot;AutoHotkey ahk_pid &quot; PID
   }

   GetScript(x, y, Diameter, d, Number, Color, Speed, hWnd)
   {
      Script =
      (
         #NoTrayIcon
         SetBatchLines, -1
         TimePeriod = 3
         DllCall(&quot;Winmm\timeBeginPeriod&quot;, UInt, TimePeriod) 
         OnExit, Exit
         
         x := %x%, y := %y%
         Color := %Color% &amp; 0xFFFFFF
         _trans := %Color%&gt;&gt;24
         
         Number := %Number%
         Width := %Diameter%
         _Width := %d%
         dW := _Width/Number
         Speed := (%Speed% &gt; 10 ? 10 : %Speed%)
         hParent := %hWnd%
         
         R := Width//2 - _Width//2
         xR := yR := Width//2
         pi := 3.141593

         ; WS_EX_LAYERED := 0x80000, WS_EX_TRANSPARENT := 0x20
         Gui, `% &quot;-Caption +E0x80020 +hwndID +ToolWindow &quot; (hParent ? &quot;+Owner&quot; hParent : &quot;+AlwaysOnTop&quot;)
         Gui, Show, NA
         OnMessage(DllCall(&quot;RegisterWindowMessage&quot;, Str, &quot;WM_INFO&quot;), &quot;WM_INFO_RECEIVER&quot;)

         pToken := GdipStartup()

         hbm := CreateDIBSection(Width+1, Width+1)
         hdc := CreateCompatibleDC()
         obm := SelectObject(hdc, hbm)
         G := GraphicsFromHDC(hdc)
         SetSmoothingMode(G, 4)

         i := 0, Angle := pi/2 - 2*pi/Number
         Time := Round(65 - Speed*(Speed &lt; 8 ? 5 : 4.4))

         Loop
         {
            Angle += 2*pi/Number
            i := i &lt; Number ? ++i : Number
            Loop 10
            {
               trans := _trans - (A_Index - 1)*2 + (dTrans := 20)
               Width_ := _Width - 0.1*dW*(A_Index - 1) + dW
               
               GraphicsClear(G)
               Loop `% i
               {
                  _Angle := Angle - (A_Index-1)*2*pi/Number
                  trans := (t := trans - dTrans) &lt; 0 ? 0 : t
                  pBrush := BrushCreateSolid(trans&lt;&lt;24|Color)
                  if ( Width_ -= dW) &gt; 0
                     FillEllipse(G, pBrush, Round(xR - Cos(_Angle)*R)- (Width_/2)
                        , Round(yR - Sin(_Angle)*R)- (Width_/2), Width_, Width_)
                  DllCall(&quot;gdiplus\GdipDeleteBrush&quot;, &quot;ptr&quot;, pBrush)
               }
               
               if hParent
               {
                  WinGetPos, xp, yp,,, ahk_id `%hParent`%
                  if (xp = &quot;&quot;)
                     ExitApp
                  _x := xp + x, _y := yp + y
               }
               else
                  _x := x, _y := y
               UpdateLayeredWindow(ID, hdc, _x-Width//2, _y-Width//2, Width+1, Width+1)
               DllCall(&quot;Sleep&quot;, UInt, Time//10)
            }
            if (Angle &gt; pi*2)
               Angle -= pi*2
            DllCall(&quot;Sleep&quot;, UInt, Time)
         }
         return
         
         GuiClose:
            ExitApp

         Exit:
            SelectObject(hdc, obm), DllCall(&quot;DeleteObject&quot;, &quot;ptr&quot;, hbm)
            DllCall(&quot;DeleteDC&quot;, &quot;ptr&quot;, hdc), DllCall(&quot;gdiplus\GdipDeleteGraphics&quot;, &quot;ptr&quot;, G)
            GdipShutdown(pToken), pToken := &quot;&quot;
            DllCall(&quot;Winmm\timeEndPeriod&quot;, UInt, TimePeriod)
            ExitApp
            
         WM_INFO_RECEIVER()
         {
            ExitApp
         }
            
         GdipStartup()
         {
            if !DllCall(&quot;GetModuleHandle&quot;, &quot;str&quot;, &quot;gdiplus&quot;, &quot;ptr&quot;)
               DllCall(&quot;LoadLibrary&quot;, &quot;str&quot;, &quot;gdiplus&quot;)
            VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
            DllCall(&quot;gdiplus\GdiplusStartup&quot;, &quot;uptr*&quot;, pToken, &quot;ptr&quot;, &amp;si, &quot;ptr&quot;, 0)
            return pToken
         }

         GdipShutdown(pToken)
         {
            DllCall(&quot;gdiplus\GdiplusShutdown&quot;, &quot;uptr&quot;, pToken)
            if hModule := DllCall(&quot;GetModuleHandle&quot;, &quot;str&quot;, &quot;gdiplus&quot;, &quot;ptr&quot;)
               DllCall(&quot;FreeLibrary&quot;, &quot;ptr&quot;, hModule)
            return 0
         }

         CreateDIBSection(w, h, bpp=32, ByRef ppvBits=0)
         {
            hdc := DllCall(&quot;GetDC&quot;, &quot;ptr&quot;, 0, &quot;ptr&quot;)
            VarSetCapacity(bi, 40, 0)
            NumPut(w, bi, 4, &quot;uint&quot;), NumPut(h, bi, 8, &quot;uint&quot;), NumPut(40, bi, 0, &quot;uint&quot;)
               , NumPut(1, bi, 12, &quot;ushort&quot;), NumPut(0, bi, 16), NumPut(bpp, bi, 14, &quot;ushort&quot;)
            hbm := DllCall(&quot;CreateDIBSection&quot;, &quot;ptr&quot; , hdc, &quot;ptr&quot; , &amp;bi
               , &quot;uint&quot; , 0, &quot;ptr*&quot;, ppvBits, &quot;ptr&quot; , 0, &quot;uint&quot; , 0, &quot;ptr&quot;)

            DllCall(&quot;ReleaseDC&quot;, &quot;ptr&quot;, 0, &quot;ptr&quot;, hdc)
            return hbm
         }

         CreateCompatibleDC(hdc=0)
         {
            return DllCall(&quot;CreateCompatibleDC&quot;, &quot;ptr&quot;, hdc, &quot;ptr&quot;)
         }

         SelectObject(hdc, hgdiobj)
         {
            return DllCall(&quot;SelectObject&quot;, &quot;ptr&quot;, hdc, &quot;ptr&quot;, hgdiobj, &quot;ptr&quot;)
         }

         GraphicsFromHDC(hdc)
         {
             DllCall(&quot;gdiplus\GdipCreateFromHDC&quot;, &quot;ptr&quot;, hdc, &quot;ptr*&quot;, pGraphics)
             return pGraphics
         }

         SetSmoothingMode(pGraphics, SmoothingMode)
         {
            return DllCall(&quot;gdiplus\GdipSetSmoothingMode&quot;, &quot;ptr&quot;, pGraphics, &quot;int&quot;, SmoothingMode)
         }

         GraphicsClear(pGraphics, ARGB=0x00ffffff)
         {
             return DllCall(&quot;gdiplus\GdipGraphicsClear&quot;, &quot;ptr&quot;, pGraphics, &quot;uint&quot;, ARGB)
         }

         BrushCreateSolid(ARGB=0xff000000)
         {
            DllCall(&quot;gdiplus\GdipCreateSolidFill&quot;, &quot;uint&quot;, ARGB, &quot;ptr*&quot;, pBrush)
            return pBrush
         }

         FillEllipse(pGraphics, pBrush, x, y, w, h)
         {
            return DllCall(&quot;gdiplus\GdipFillEllipse&quot;, &quot;ptr&quot;, pGraphics, &quot;ptr&quot;, pBrush, &quot;float&quot;, x, &quot;float&quot;, y, &quot;float&quot;, w, &quot;float&quot;, h)
         }

         UpdateLayeredWindow(hwnd, hdc, x=&quot;&quot;, y=&quot;&quot;, w=&quot;&quot;, h=&quot;&quot;, Alpha=255)
         {
            if ((x != &quot;&quot;) &amp;&amp; (y != &quot;&quot;))
               VarSetCapacity(pt, 8), NumPut(x, pt, 0, &quot;uint&quot;), NumPut(y, pt, 4, &quot;uint&quot;)

            if (w = &quot;&quot;) ||(h = &quot;&quot;)
               WinGetPos,,, w, h, ahk_id `%hwnd`%
            
            return DllCall(&quot;UpdateLayeredWindow&quot;, &quot;ptr&quot;, hwnd, &quot;ptr&quot;, 0, &quot;ptr&quot;, ((x = &quot;&quot;) &amp;&amp; (y = &quot;&quot;)) ? 0 : &amp;pt
            , &quot;int64*&quot;, w|h&lt;&lt;32, &quot;ptr&quot;, hdc, &quot;int64*&quot;, 0, &quot;uint&quot;, 0, &quot;uint*&quot;, Alpha&lt;&lt;16|1&lt;&lt;24, &quot;uint&quot;, 2)
         }
      )
      return Script
   }
}</code></pre></div><p>И, конечно, на компьютере, где запускается скрипт, независимо от того, скомпилирован он, или нет, <strong>должен быть установлен AHK</strong>. Либо нужно прикреплять AutoHotkey.exe с помощью FileInstall и вместо A_AhkPath подставлять путь к нему.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2013-12-28T09:33:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78582#p78582</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78578#p78578" />
			<content type="html"><![CDATA[<p>Скажите почему не работает на некоторых компьютерах.<br />Я 4 протестировал.<br />На всех установлена ос Win7&nbsp; , на трех 32 bit - одна 64 bit.<br />64 bit - не работает .<br />32 bit - работает на двух машинах.<br />Почему , может не хватает некоторых библиотек?<br />(Скрипт был скомпилирован с разными параметрами)<br />AHK v&nbsp; 1.1.13.01 (unicode - 32 bit)<br />Ошибка такого рода:<span class="postimg"><img src="http://forum.script-coding.com/misc.php?action=pun_attachment&amp;item=616&amp;download=1&amp;secure_str=26155t8609" alt="http://forum.script-coding.com/misc.php?action=pun_attachment&amp;amp;item=616&amp;amp;download=1&amp;amp;secure_str=26155t8609" /></span></p>]]></content>
			<author>
				<name><![CDATA[Zanoza]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26155</uri>
			</author>
			<updated>2013-12-28T00:47:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78578#p78578</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Анимированная картинка «ожидание»]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=74963#p74963" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Irbis пишет:</cite><blockquote><p>Для уверенности в работе родителя можно поставить таймер, и посылать сообщения потомкам с неким интервалом.</p></blockquote></div><p>Это несложно. В таком варианте, если основной скрипт завис (чего можно добиться, вызвав контекстное меню его иконки в трее), изображения через пару секунд тоже &quot;зависнут&quot;, ожидая, пока основной скрипт &quot;отвиснет&quot;:<br /></p><div class="codebox"><pre><code>^1::Waiting() ; запуск по умолчанию для демонстрации

; запуск двух экземпляров одновременно с блокнотом, как окном-владельцем,
; картинки будут перемещаться вместе с окном блокнота.
; при закрытии окна-владельца процессы картинок завершатся.
^2::
   DetectHiddenWindows, On
   Run, notepad.exe,, hide, PID
   WinWait, ahk_pid %PID%
   WinMove,,, (A_ScreenWidth - 400)//2, 100, 400, 300
   WinShow
   hParent := WinExist()
   
   PID1 := Waiting(&quot;&quot;, 130, 160, 50, 11, 10, 0xCCFFBE00, 10, hParent)
   PID2 := Waiting(&quot;&quot;, 260, 160, 100, 22, 10, 0xCC5A5192, 6, hParent)
   return

^3::Waiting(PID2)   ; завершаем процесс с идентификатором PID2

; Прикольно :)
^4::Waiting(&quot;&quot;, A_ScreenWidth//2, A_ScreenHeight//2, d := A_ScreenHeight - 100, d//4, 10, 0xCCFFBE00, 5)

^Space::Waiting(0)  ; закрываем все созданные процессы, передавая в функцию 0

Esc::ExitApp
return

Waiting(PID=&quot;&quot;, x=&quot;&quot;, y=&quot;&quot;, Diameter=70, d=17, Number=9, Color=0xCC70A0D0, Speed=5, hParent=&quot;&quot;)
{
/*
PID — если пустое значение — запускается новый процесс,
           если числовое значение — закрывается процесс с данным идентификатором
           если 0 — закрываются все процессы, запущенные функцией
x, y — координаты центра вращения, если в параметре hParent указан хэндл
           окна-владельца — считаются от его верхнего левого угла, иначе — относительно экрана
Diameter — общий диаметр изображения
d — диаметр элемента изображения
Number — количество элементов
Color — прозрачность и цвет изображения в формате 0xFFFFFFFF,
           где старший байт — прозрачность, остальные — цвет в RGB
Speed — скорость вращения изображения от 0 до 10
hParent — хэндл окна-владельца, если не указан, картинка будет AlwaysOnTop

Функция возвращает PID запущенного процесса.
*/

   static Waiting := new Waiting_Graphics
   (x = &quot;&quot;) ? x := A_ScreenWidth//2
   (y = &quot;&quot;) ? y := A_ScreenHeight//2
   if (PID = &quot;&quot;)
   {
      NewPID := Waiting.RunScript(x, y, Diameter, d, Number, Color, Speed, hParent)
      SetTimer, ControlTimer, 1000
      Return NewPID
   }
   else
      Waiting.TerminateScript(PID)
   return
   
ControlTimer:
   if !Waiting.PIDs.1
      SetTimer, ControlTimer, Off
   
   Waiting.ControlScript()
   return
}

class Waiting_Graphics
{
   __New()
   {
      this.PIDs := []
      this.WM_INFO := DllCall(&quot;RegisterWindowMessage&quot;, Str, &quot;WM_INFO&quot;)
   }
   
   __Delete()
   {
      for k,v in this.PIDs
         WinClose, % &quot;ahk_pid&quot; v
   }
   
   RunScript(x, y, Diameter, d, Number, Color, Speed, hWnd)
   {
      VarSetCapacity(TmpFilePath, MAX_PATH := 260)
      DllCall(&quot;GetTempFileName&quot;, Str, A_Temp, Str, &quot;Wtg&quot;, UInt, 0, Ptr, &amp;TmpFilePath)
      VarSetCapacity(TmpFilePath, -1)
      FileAppend, % this.GetScript(x, y, Diameter, d, Number, Color, Speed, hWnd), % TmpFilePath
      Run, % A_AhkPath &quot; &quot;&quot;&quot; TmpFilePath &quot;&quot;&quot;&quot;,,, PID
      DetectHiddenWindows, On
      WinWait, % &quot;ahk_pid&quot; PID
      FileDelete, % TmpFilePath
      this.PIDs.Insert(PID)
      Return PID
   }
   
   ControlScript()
   {
      for k,v in this.PIDs
         PostMessage, this.WM_INFO, 1,,, % &quot;ahk_pid&quot; v
   }

   TerminateScript(PID)
   {
      if PID
      {
         PostMessage, this.WM_INFO,,,, % &quot;ahk_pid&quot; PID
         for k,v in this.PIDs
            if (v = PID)
               this.PIDs.Remove(k)
      }
      else
      {
         for k,v in this.PIDs
            PostMessage, this.WM_INFO,,,, % &quot;ahk_pid&quot; v
         this.PIDs := []
      }
   }

   GetScript(x, y, Diameter, d, Number, Color, Speed, hWnd)
   {
      Script =
      (
         #NoTrayIcon
         SetBatchLines, -1
         TimePeriod = 3
         waiting := A_TickCount
         DllCall(&quot;Winmm\timeBeginPeriod&quot;, UInt, TimePeriod) 
         OnExit, Exit
         
         x := %x%, y := %y%
         Color := %Color% &amp; 0xFFFFFF
         _trans := %Color%&gt;&gt;24
         
         Number := %Number%
         Width := %Diameter%
         _Width := %d%
         dW := _Width/Number
         Speed := (%Speed% &gt; 10 ? 10 : %Speed%)
         hParent := %hWnd%
         
         R := Width//2 - _Width//2
         xR := yR := Width//2
         pi := 3.141593

         ; WS_EX_LAYERED := 0x80000, WS_EX_TRANSPARENT := 0x20
         Gui, `% &quot;-Caption +E0x80020 +hwndID +ToolWindow &quot; (hParent ? &quot;+Owner&quot; hParent : &quot;+AlwaysOnTop&quot;)
         Gui, Show, NA
         OnMessage(DllCall(&quot;RegisterWindowMessage&quot;, Str, &quot;WM_INFO&quot;), &quot;WM_INFO_RECEIVER&quot;)

         pToken := GdipStartup()

         hbm := CreateDIBSection(Width+1, Width+1)
         hdc := CreateCompatibleDC()
         obm := SelectObject(hdc, hbm)
         G := GraphicsFromHDC(hdc)
         SetSmoothingMode(G, 4)

         i := 0, Angle := pi/2 - 2*pi/Number
         Time := Round(65 - Speed*(Speed &lt; 8 ? 5 : 4.4))

         Loop
         {
            if (A_TickCount - waiting &gt; 2000)
            {
               Sleep, 300
               continue
            }
            
            Angle += 2*pi/Number
            i := i &lt; Number ? ++i : Number
            Loop 10
            {
               if ExitEvent
               {
                  _trans -= 2
                  if _trans &lt;= 0
                     ExitApp
               }
               trans := _trans - (A_Index - 1)*2 + (dTrans := 20)
               Width_ := _Width - 0.1*dW*(A_Index - 1) + dW
               
               GraphicsClear(G)
               Loop `% i
               {
                  _Angle := Angle - (A_Index-1)*2*pi/Number
                  trans := (t := trans - dTrans) &lt; 0 ? 0 : t
                  pBrush := BrushCreateSolid(trans&lt;&lt;24|Color)
                  if ( Width_ -= dW) &gt; 0
                     FillEllipse(G, pBrush, Round(xR - Cos(_Angle)*R)- (Width_/2)
                        , Round(yR - Sin(_Angle)*R)- (Width_/2), Width_, Width_)
                  DllCall(&quot;gdiplus\GdipDeleteBrush&quot;, &quot;ptr&quot;, pBrush)
               }
               
               if hParent
               {
                  WinGetPos, xp, yp,,, ahk_id `%hParent`%
                  if (xp = &quot;&quot;)
                     ExitApp
                  _x := xp + x, _y := yp + y
               }
               else
                  _x := x, _y := y
               UpdateLayeredWindow(ID, hdc, _x-Width//2, _y-Width//2, Width+1, Width+1)
               DllCall(&quot;Sleep&quot;, UInt, Time//10)
            }
            if (Angle &gt; pi*2)
               Angle -= pi*2
            DllCall(&quot;Sleep&quot;, UInt, Time)
         }
         return
         
         GuiClose:
            ExitApp

         Exit:
            SelectObject(hdc, obm), DllCall(&quot;DeleteObject&quot;, &quot;ptr&quot;, hbm)
            DllCall(&quot;DeleteDC&quot;, &quot;ptr&quot;, hdc), DllCall(&quot;gdiplus\GdipDeleteGraphics&quot;, &quot;ptr&quot;, G)
            GdipShutdown(pToken), pToken := &quot;&quot;
            DllCall(&quot;Winmm\timeEndPeriod&quot;, UInt, TimePeriod)
            ExitApp
            
         WM_INFO_RECEIVER(wp)
         {
            global ExitEvent, waiting
            if !wp
               ExitEvent := 1
            else
               waiting := A_TickCount
         }
            
         GdipStartup()
         {
            if !DllCall(&quot;GetModuleHandle&quot;, &quot;str&quot;, &quot;gdiplus&quot;, &quot;ptr&quot;)
               DllCall(&quot;LoadLibrary&quot;, &quot;str&quot;, &quot;gdiplus&quot;)
            VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
            DllCall(&quot;gdiplus\GdiplusStartup&quot;, &quot;uptr*&quot;, pToken, &quot;ptr&quot;, &amp;si, &quot;ptr&quot;, 0)
            return pToken
         }

         GdipShutdown(pToken)
         {
            DllCall(&quot;gdiplus\GdiplusShutdown&quot;, &quot;uptr&quot;, pToken)
            if hModule := DllCall(&quot;GetModuleHandle&quot;, &quot;str&quot;, &quot;gdiplus&quot;, &quot;ptr&quot;)
               DllCall(&quot;FreeLibrary&quot;, &quot;ptr&quot;, hModule)
            return 0
         }

         CreateDIBSection(w, h, hdc=&quot;&quot;, bpp=32, ByRef ppvBits=0)
         {
            hdc2 := hdc ? hdc : DllCall(&quot;GetDC&quot;, &quot;ptr&quot;, 0, &quot;ptr&quot;)
            VarSetCapacity(bi, 40, 0)
            NumPut(w, bi, 4, &quot;uint&quot;), NumPut(h, bi, 8, &quot;uint&quot;), NumPut(40, bi, 0, &quot;uint&quot;)
               , NumPut(1, bi, 12, &quot;ushort&quot;), NumPut(0, bi, 16), NumPut(bpp, bi, 14, &quot;ushort&quot;)
            hbm := DllCall(&quot;CreateDIBSection&quot;, &quot;ptr&quot; , hdc2, &quot;ptr&quot; , &amp;bi
               , &quot;uint&quot; , 0, &quot;ptr*&quot;, ppvBits, &quot;ptr&quot; , 0, &quot;uint&quot; , 0, &quot;ptr&quot;)

            if !hdc
               DllCall(&quot;ReleaseDC&quot;, &quot;ptr&quot;, 0, &quot;ptr&quot;, hdc2)
            return hbm
         }

         CreateCompatibleDC(hdc=0)
         {
            return DllCall(&quot;CreateCompatibleDC&quot;, &quot;ptr&quot;, hdc, &quot;ptr&quot;)
         }

         SelectObject(hdc, hgdiobj)
         {
            return DllCall(&quot;SelectObject&quot;, &quot;ptr&quot;, hdc, &quot;ptr&quot;, hgdiobj, &quot;ptr&quot;)
         }

         GraphicsFromHDC(hdc)
         {
             DllCall(&quot;gdiplus\GdipCreateFromHDC&quot;, &quot;ptr&quot;, hdc, &quot;ptr*&quot;, pGraphics)
             return pGraphics
         }

         SetSmoothingMode(pGraphics, SmoothingMode)
         {
            return DllCall(&quot;gdiplus\GdipSetSmoothingMode&quot;, &quot;ptr&quot;, pGraphics, &quot;int&quot;, SmoothingMode)
         }

         GraphicsClear(pGraphics, ARGB=0x00ffffff)
         {
             return DllCall(&quot;gdiplus\GdipGraphicsClear&quot;, &quot;ptr&quot;, pGraphics, &quot;uint&quot;, ARGB)
         }

         BrushCreateSolid(ARGB=0xff000000)
         {
            DllCall(&quot;gdiplus\GdipCreateSolidFill&quot;, &quot;uint&quot;, ARGB, &quot;ptr*&quot;, pBrush)
            return pBrush
         }

         FillEllipse(pGraphics, pBrush, x, y, w, h)
         {
            return DllCall(&quot;gdiplus\GdipFillEllipse&quot;, &quot;ptr&quot;, pGraphics, &quot;ptr&quot;, pBrush, &quot;float&quot;, x, &quot;float&quot;, y, &quot;float&quot;, w, &quot;float&quot;, h)
         }

         UpdateLayeredWindow(hwnd, hdc, x=&quot;&quot;, y=&quot;&quot;, w=&quot;&quot;, h=&quot;&quot;, Alpha=255)
         {
            if ((x != &quot;&quot;) &amp;&amp; (y != &quot;&quot;))
               VarSetCapacity(pt, 8), NumPut(x, pt, 0, &quot;uint&quot;), NumPut(y, pt, 4, &quot;uint&quot;)

            if (w = &quot;&quot;) ||(h = &quot;&quot;)
               WinGetPos,,, w, h, ahk_id `%hwnd`%
            
            return DllCall(&quot;UpdateLayeredWindow&quot;, &quot;ptr&quot;, hwnd, &quot;ptr&quot;, 0, &quot;ptr&quot;, ((x = &quot;&quot;) &amp;&amp; (y = &quot;&quot;)) ? 0 : &amp;pt
            , &quot;int64*&quot;, w|h&lt;&lt;32, &quot;ptr&quot;, hdc, &quot;int64*&quot;, 0, &quot;uint&quot;, 0, &quot;uint*&quot;, Alpha&lt;&lt;16|1&lt;&lt;24, &quot;uint&quot;, 2)
         }
      )
      return Script
   }
}</code></pre></div><div class="quotebox"><cite>Irbis пишет:</cite><blockquote><p>Например, есть идея запустить 4 потока, ожидающих сообщения с координатами, и чтоб каждый из 4х потоков производил PixelSearch в отведенной ему области экрана, и в случае нахождения возвращал бы координаты родителю.</p></blockquote></div><p>Да, хороший повод для применения многопоточности, если нужна скорость. Попробуй реализовать. Потом сделаем пост в Коллекции.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2013-08-26T18:21:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=74963#p74963</id>
		</entry>
</feed>
