<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Мигает картинка gui при ее изменении]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=12216&amp;type=atom" />
	<updated>2016-12-17T10:58:59Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=12216</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109909#p109909" />
			<content type="html"><![CDATA[<p>Если в 13 код добавить:<br /></p><div class="codebox"><pre><code>f11::
Gui,2:  +AlwaysOnTop
Gui,2: Add, Text,, Please enter your name:
Gui,2: Add, Button, Default, OK
Gui,2:  Show
return</code></pre></div><p>То при нажатии f11 новый гуи будет поверх старого.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-12-17T10:58:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109909#p109909</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109891#p109891" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong><br />Худо бедно разобрался , а как насчет слоев?<br />Без gdi+ я сделал несколько окон gui одно на одном .<br />Во всех них было прописано AlwaysOnTop, и друг на друга они налаживались в порядке их вызова. <br />Однако теперь фон который я сделал с gdi+ всегда находиться поверх других gui.</p>]]></content>
			<author>
				<name><![CDATA[cahtbap1]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34377</uri>
			</author>
			<updated>2016-12-16T09:05:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109891#p109891</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109832#p109832" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Только вот где я могу прописать координаты картинки?Масштабирование и т.д.</p></blockquote></div><div class="codebox"><pre><code>; Update the specified window we have created (hwnd1) with a handle to our bitmap (hdc), specifying the x,y,w,h we want it positioned on our screen
; So this will position our gui at (0,0) with the Width and Height specified earlier (half of the original image)
UpdateLayeredWindow(hwnd1, hdc, 0, 0, Width//2, Height//2)</code></pre></div><div class="quotebox"><blockquote><p>И еще как мне тут задать те 200 полупрозрачности?</p></blockquote></div><p>Не знаю. Наверное копать матрицу.<br />Либо сразу создавать полупрозрачные png.<br /></p><div class="codebox"><pre><code>; DrawImage will draw the bitmap we took from the file into the graphics of the bitmap we created
; We are wanting to draw the entire image, but at half its size
; Coordinates are therefore taken from (0,0) of the source bitmap and also into the destination bitmap
; The source height and width are specified, and also the destination width and height (half the original)
; Gdip_DrawImage(pGraphics, pBitmap, dx, dy, dw, dh, sx, sy, sw, sh, Matrix)
; d is for destination and s is for source. We will not talk about the matrix yet (this is for changing colours when drawing)
Gdip_DrawImage(G, pBitmap, 0, 0, Width//2, Height//2, 0, 0, Width, Height)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-12-13T12:54:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109832#p109832</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109830#p109830" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong><br />Все работает , вот такой код получился.<br /></p><div class="codebox"><pre><code>
#SingleInstance, Force
#NoEnv
SetBatchLines, -1
#Include, C:\Program Files\AutoHotkey\lib\Gdip.ahk
If !pToken := Gdip_Startup()
{
	MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
	ExitApp
}
OnExit, Exit
Gui, 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, 1: Show, NA
hwnd1 := WinExist()
SetTimer,circle,100
return

gdi:
If !pBitmap
{
	MsgBox, 48, File loading error!, Could not load the image specified
	ExitApp
}

Width := Gdip_GetImageWidth(pBitmap), Height := Gdip_GetImageHeight(pBitmap)
hbm := CreateDIBSection(Width//2, Height//2)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetInterpolationMode(G, 7)
Gdip_DrawImage(G, pBitmap, 0, 0, Width//2, Height//2, 0, 0, Width, Height)
UpdateLayeredWindow(hwnd1, hdc, 0, 0, Width//2, Height//2)
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(G)
Gdip_DisposeImage(pBitmap)
Return

Exit:
Gdip_Shutdown(pToken)
ExitApp
Return

circle:
gosub get
if f=%ff%
	return
if f = 0
    pBitmap := Gdip_CreateBitmapFromFile(&quot;фон0.png&quot;)
if f = 10
    pBitmap := Gdip_CreateBitmapFromFile(&quot;фон1.png&quot;)
if f = 12
    pBitmap := Gdip_CreateBitmapFromFile(&quot;фон2.png&quot;)
if f = 2
    pBitmap := Gdip_CreateBitmapFromFile(&quot;фон3.png&quot;)
if f = 22
    pBitmap := Gdip_CreateBitmapFromFile(&quot;фон4.png&quot;)
if f = 20
    pBitmap := Gdip_CreateBitmapFromFile(&quot;фон5.png&quot;)
if f = 21
    pBitmap := Gdip_CreateBitmapFromFile(&quot;фон6.png&quot;)
if f = 1
    pBitmap := Gdip_CreateBitmapFromFile(&quot;фон7.png&quot;)
if f = 11
    pBitmap := Gdip_CreateBitmapFromFile(&quot;фон8.png&quot;)
goto gdi
return
get:
ff=%f%
f=0
GetKeyState, joyx, JoyX
GetKeyState, joyy, JoyY
if joyx &lt; 47
    EnvAdd,f,1
if joyx &gt; 53
    EnvAdd,f,2
if joyy &lt; 47
    EnvAdd,f,10
if joyy &gt; 53
    EnvAdd,f,20
return</code></pre></div><p>Только вот где я могу прописать координаты картинки?Масштабирование и т.д.<br />И еще как мне тут задать те 200 полупрозрачности?<br /></p><div class="codebox"><pre><code>
WinSet, TransColor, EEAA99 200</code></pre></div>]]></content>
			<author>
				<name><![CDATA[cahtbap1]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34377</uri>
			</author>
			<updated>2016-12-13T10:46:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109830#p109830</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109829#p109829" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>C:\Program Files\AutoHotkey\lib</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-12-13T10:10:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109829#p109829</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109828#p109828" />
			<content type="html"><![CDATA[<p>А куда можно этот gdip.ahk закинуть чтоб все время его по папкам не таскать , и длинные пути не прописывать?</p>]]></content>
			<author>
				<name><![CDATA[cahtbap1]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34377</uri>
			</author>
			<updated>2016-12-13T10:08:25Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109828#p109828</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109827#p109827" />
			<content type="html"><![CDATA[<p>Переименовал gdip_all.ahk в gdip.ahk все заработало.Спасибо , буду разбираться :-)</p>]]></content>
			<author>
				<name><![CDATA[cahtbap1]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34377</uri>
			</author>
			<updated>2016-12-13T10:07:07Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109827#p109827</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109826#p109826" />
			<content type="html"><![CDATA[<p>Попробовал тот скрипт в теме отдельно сохранить как gdip.ahk и убрать ; перед #Include, Gdip.ahk , с виду прогресс двинулся и скрипт остается включенным , но ничего не показывает.</p>]]></content>
			<author>
				<name><![CDATA[cahtbap1]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34377</uri>
			</author>
			<updated>2016-12-13T10:02:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109826#p109826</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109825#p109825" />
			<content type="html"><![CDATA[<p><a href="https://www.dropbox.com/s/0e9gdfetbfa8v0o/Gdip_All.ahk">https://www.dropbox.com/s/0e9gdfetbfa8v0o/Gdip_All.ahk</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-12-13T09:59:28Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109825#p109825</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109824#p109824" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong><br />Я не знаю как этим пользоваться , этот скрипт у меня не работает . Может это библиотека какая то&nbsp; и ее устанавливать нужно?Давай лучше по порядку что и как мне делать?</p>]]></content>
			<author>
				<name><![CDATA[cahtbap1]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34377</uri>
			</author>
			<updated>2016-12-13T09:56:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109824#p109824</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109815#p109815" />
			<content type="html"><![CDATA[<p>Только тот, что по ссылке:<br /></p><div class="codebox"><pre><code>; Requires Gdip.ahk either in your Lib folder as standard library or using #Include

#SingleInstance, Force
#NoEnv
SetBatchLines, -1

; Uncomment if Gdip.ahk is not in your standard library
;#Include, Gdip.ahk

; Start gdi+
If !pToken := Gdip_Startup()
{
	MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
	ExitApp
}
OnExit, Exit

; Create a layered window (+E0x80000 : must be used for UpdateLayeredWindow to work!) that is always on top (+AlwaysOnTop), has no taskbar entry or caption
Gui, 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs

; Show the window
Gui, 1: Show, NA

; Get a handle to this window we have created in order to update it later
hwnd1 := WinExist()

loop
{
   loop 9
   {
      pBitmap := Gdip_CreateBitmapFromFile(&quot;фон&quot; A_Index-1 &quot;.png&quot;)
      GoSub gdi
      sleep 100
   }
}
return


gdi:
; Check to ensure we actually got a bitmap from the file, in case the file was corrupt or some other error occured
If !pBitmap
{
	MsgBox, 48, File loading error!, Could not load the image specified
	ExitApp
}

; Get the width and height of the bitmap we have just created from the file
; This will be the dimensions that the file is
Width := Gdip_GetImageWidth(pBitmap), Height := Gdip_GetImageHeight(pBitmap)

; Create a gdi bitmap with width and height of what we are going to draw into it. This is the entire drawing area for everything
; We are creating this &quot;canvas&quot; at half the size of the actual image
; We are halving it because we want the image to show in a gui on the screen at half its dimensions
hbm := CreateDIBSection(Width//2, Height//2)

; Get a device context compatible with the screen
hdc := CreateCompatibleDC()

; Select the bitmap into the device context
obm := SelectObject(hdc, hbm)

; Get a pointer to the graphics of the bitmap, for use with drawing functions
G := Gdip_GraphicsFromHDC(hdc)

; We do not need SmoothingMode as we did in previous examples for drawing an image
; Instead we must set InterpolationMode. This specifies how a file will be resized (the quality of the resize)
; Interpolation mode has been set to HighQualityBicubic = 7
Gdip_SetInterpolationMode(G, 7)

; DrawImage will draw the bitmap we took from the file into the graphics of the bitmap we created
; We are wanting to draw the entire image, but at half its size
; Coordinates are therefore taken from (0,0) of the source bitmap and also into the destination bitmap
; The source height and width are specified, and also the destination width and height (half the original)
; Gdip_DrawImage(pGraphics, pBitmap, dx, dy, dw, dh, sx, sy, sw, sh, Matrix)
; d is for destination and s is for source. We will not talk about the matrix yet (this is for changing colours when drawing)
Gdip_DrawImage(G, pBitmap, 0, 0, Width//2, Height//2, 0, 0, Width, Height)

; Update the specified window we have created (hwnd1) with a handle to our bitmap (hdc), specifying the x,y,w,h we want it positioned on our screen
; So this will position our gui at (0,0) with the Width and Height specified earlier (half of the original image)
UpdateLayeredWindow(hwnd1, hdc, 0, 0, Width//2, Height//2)


; Select the object back into the hdc
SelectObject(hdc, obm)

; Now the bitmap may be deleted
DeleteObject(hbm)

; Also the device context related to the bitmap may be deleted
DeleteDC(hdc)

; The graphics may now be deleted
Gdip_DeleteGraphics(G)

; The bitmap we made from the image may be deleted
Gdip_DisposeImage(pBitmap)
Return

;#######################################################################

Exit:
; gdi+ may now be shutdown on exiting the program
Gdip_Shutdown(pToken)
ExitApp
Return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-12-12T18:48:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109815#p109815</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109814#p109814" />
			<content type="html"><![CDATA[<p>Есть какой то гайдик толковый? Я не против научиться чему то новому.<br />Попробовал скрипты по ссылке , с виду не очень понятно , а английские коментарии только запутывают.<br />Копировал все что вижу , запускал в разной последовательности и разными комбинациями , ничего не получилось).</p>]]></content>
			<author>
				<name><![CDATA[cahtbap1]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34377</uri>
			</author>
			<updated>2016-12-12T18:18:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109814#p109814</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109811#p109811" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Через GDI+ можно.</p></blockquote></div><p>Что оно такое и как его использовать?</p>]]></content>
			<author>
				<name><![CDATA[cahtbap1]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34377</uri>
			</author>
			<updated>2016-12-12T18:01:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109811#p109811</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109802#p109802" />
			<content type="html"><![CDATA[<p>Через GDI+ можно.<br /><a href="https://autohotkey.com/board/topic/29449-gdi-standard-library-145-by-tic/">https://autohotkey.com/board/topic/2944 … 45-by-tic/</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-12-12T16:26:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109802#p109802</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Мигает картинка gui при ее изменении]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=109799#p109799" />
			<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>2016-12-12T14:39:31Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=109799#p109799</id>
		</entry>
</feed>
