<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: AlwaysOnTop внутри Родителя]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10770&amp;type=atom" />
	<updated>2015-08-02T18:45:42Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10770</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96187#p96187" />
			<content type="html"><![CDATA[<p>Во, спасибо! Но кликом Edit не активируется. Если только через костыль ControlFocus - ControlClick, как вариант.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-08-02T18:45:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96187#p96187</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96183#p96183" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Gui, +0x40000000 -0x80000000  ; Add WS_CHILD, remove WS_POPUP</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2015-08-02T18:18:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96183#p96183</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96178#p96178" />
			<content type="html"><![CDATA[<p>В первом примере контрол AutoHotkey принадлежит процессу родителя, видимо должен быть способ тоже самое сделать с окном...</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-08-02T12:54:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96178#p96178</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=96174#p96174" />
			<content type="html"><![CDATA[<p>В данном примере, активируя свой Edit, родительское окно не деактивируется:<br /></p><div class="codebox"><pre><code>
If !WinExist(&quot;ahk_class Notepad&quot;)  
{
    Run, Notepad,,, PID
    WinWait, ahk_pid %PID%
}
hNotepad := WinExist(&quot;ahk_class Notepad&quot;)
ControlGet, hEdit1, Hwnd, , Edit1, ahk_id %hNotepad% 
Gui, Add, Edit, w111 h111 x111 y111 HWNDh_Edit, Edit
DllCall(&quot;SetParent&quot;, &quot;uint&quot;, h_Edit, &quot;uint&quot;, hEdit1)   
WinActivate
Return
</code></pre></div><p>Возможно ли разместить в родителе своё окно, чтобы можно было им полноценно пользоватся, активировать, перемещать, изменять размер, вводить текст, но чтобы при этом не деактивировалось родительское?<br /></p><div class="codebox"><pre><code>
If !WinExist(&quot;ahk_class Notepad&quot;)  
{
    Run, Notepad,,, PID
    WinWait, ahk_pid %PID%
}
hNotepad := WinExist(&quot;ahk_class Notepad&quot;)
ControlGet, hEdit1, Hwnd, , Edit1, ahk_id %hNotepad%  
Gui, +AlwaysOnTop -DPIScale +HWNDhWin +ReSize
Gui, Add, Edit, w222 h222 x1 y1  
DllCall(&quot;SetParent&quot;, &quot;uint&quot;, hWin, &quot;uint&quot;, hEdit1)   
Gui, Show, na w222 h222 x111 y111, % &quot; &quot;
WinActivate 
Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-08-01T23:39:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=96174#p96174</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95283#p95283" />
			<content type="html"><![CDATA[<p>В <a href="http://forum.script-coding.com/viewtopic.php?id=9163">этой теме</a> не созвучный вопрос поднимался?</p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2015-07-11T14:43:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95283#p95283</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95279#p95279" />
			<content type="html"><![CDATA[<p>serzh82saratov, спасибо, уже буду думать как быть.</p>]]></content>
			<author>
				<name><![CDATA[samardac]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33189</uri>
			</author>
			<updated>2015-07-11T13:34:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95279#p95279</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95277#p95277" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Проще сделать его <strong>как то</strong> прозрачным где надо.</p></blockquote></div><p>Не знаю как ещё.<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><div class="codebox"><pre><code>
#SingleInstance Force      
#Persistent 
#NoEnv
ListLines Off  
DetectHiddenWindows, On
SetWinEventHook(0x8005, 0x8005, 0, RegisterCallback(&quot;MyFunc&quot;, &quot;F&quot;),0,0,0) ; EVENT_OBJECT_FOCUS 
SetWinEventHook(0x800B, 0x800B, 0, RegisterCallback(&quot;MyFunc&quot;, &quot;F&quot;),0,0,0) ; EVENT_OBJECT_LOCATIONCHANGE
Gui, Main: Color, EEAA99
Gui, Main: +HwndmainGuiId +LastFound  
Gui, Child2: Color, 198A05
Gui, Child2: +ParentMain +HwndchildGuiId2 +AlwaysOnTop 
Run, Notepad,, Hide
WinWait, ahk_class Notepad
Global External := WinExist(&quot;ahk_class Notepad&quot;), childGuiID2 
DllCall(&quot;SetParent&quot;, &quot;uint&quot;, External, &quot;uint&quot;, mainGuiId) 
WinMove, ahk_id %External%, , 110,110, 444, 444
WinShow, ahk_id %External%
Gui, Child2: Show, x222 y222 w200 h200, Child GUI 2
Gui, Main: Show, w600 h600 
WinSet, Top, , ahk_id %childGuiID2% 
 ; WinSet, ExStyle, +0x08000000, ahk_id %External%   ;  WS_EX_NOACTIVATE
WinSet, Region, 
(
0-0 200-0 200-200 0-200 0-0 
 50-50 80-50 80-80 50-80 50-50  
 100-100 100-180 180-180 150-180 150-150 
), ahk_id %childGuiID2%
WinSet, Redraw, , ahk_id %mainGuiId% 
WinSet, Redraw, , ahk_id %External% 
WinSet, Redraw, , ahk_id %childGuiID2%  
return

MyFunc(hWinEventHook, event, hwnd) { 
    If (hwnd = External) 
        WinSet, Top, , ahk_id %childGuiID2%   
}

SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags)
{
   return DllCall(&quot;SetWinEventHook&quot; , UInt, eventMin, UInt, eventMax
                                    , Ptr, hmodWinEventProc, Ptr, lpfnWinEventProc
                                    , UInt, idProcess, UInt, idThread
                                    , UInt, dwFlags, Ptr)
}
</code></pre></div></div></div><p>Но с помощью WinSet, Region можно хоть картину пикассо обрисовать, при большом желании.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-07-11T13:29:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95277#p95277</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95275#p95275" />
			<content type="html"><![CDATA[<p>Вообще не думаю что WinSet, Region, подойдет, так как это окно Child2 будет полностью графическим и края его будут &quot;кучерявые&quot; а не просто окно - прямоугольник. И придется резать очень много и не просто регионом а полигонами. Проще сделать его как то прозрачным где надо.</p>]]></content>
			<author>
				<name><![CDATA[samardac]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33189</uri>
			</author>
			<updated>2015-07-11T13:13:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95275#p95275</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95273#p95273" />
			<content type="html"><![CDATA[<p>serzh82saratov, суть такая, есть:<br />1. Окно Child2, это окно которое всегда на верху. <br />2. Приложение(блокнот), которое находится под Child2<br />3. Родительсоке окно оно содержит в себе два предыдущих окна.</p><p>Child2, в некоторых местах должен быть прозрачным, что бы можно было&nbsp; взаимодействовать мышкой с приложение которое под ним.</p><p>WinSet, Region, позволит сделать много &quot;форточек&quot;? Так как там нужна не одна дырка.</p>]]></content>
			<author>
				<name><![CDATA[samardac]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33189</uri>
			</author>
			<updated>2015-07-11T13:02:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95273#p95273</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95272#p95272" />
			<content type="html"><![CDATA[<p>Не уверен что точно понял, может просто в нём сделать &quot;форточку&quot; с помощью WinSet, Region?</p><p>Никогда не пишите &quot;Untitled&quot; для блокнота.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-07-11T12:59:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95272#p95272</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95270#p95270" />
			<content type="html"><![CDATA[<p>serzh82saratov, появилась еще одна проблема она состоит в том что окно Child2 имеет прозрачные части сквозь которые можно взаимодействовать с неокоторыми частями приложения, но при этом методе скрипт номер1, если делаеш Child2 прозрачным припомощи WinSet, TransColor так он пробивает родительское окно на сквозь, в итоги ты видиш не приложение что подним, а то что под родительским окном.&nbsp; Есть ли како то вариант исправить это?<br />И еще, прозрачность окна Child2 работает только если она совпадает с прозрачность цвета Родительского окна.</p><div class="codebox"><pre><code>
DetectHiddenWindows, On
Gui, Main: Color, EEAA99
Gui, Main: +HwndmainGuiId  
Gui, Main: +LastFound  +resize
WinSet, TransColor, EEAA99
Gui, Main: Show, w600 h600


Gui, Child2: +ParentMain +HwndchildGuiId2 +AlwaysOnTop
Gui, Child2: Color, EEAA99
Gui, Child2: +LastFound 
WinSet, TransColor, EEAA99
Gui, Child2: Show, x100 y0 w300 h100, Child GUI 2

Run, Notepad,, Hide
WinWait, ahk_class Notepad
Global External := WinExist(&quot;Untitled&quot;), childGuiID2
DllCall(&quot;SetParent&quot;, &quot;uint&quot;, External, &quot;uint&quot;, mainGuiId) 
WinMove, ahk_id %External%, , 0,0 
WinShow, ahk_id %External%
WinSet, Top, , ahk_id %childGuiID2%
Gui, Main: Show
SetWinEventHook(0x8005, 0x8005, 0, RegisterCallback(&quot;MyFunc&quot;, &quot;F&quot;),0,0,0) 
; 0x8005 = EVENT_OBJECT_FOCUS  
return

MyFunc(hWinEventHook, event, hwnd) { 
    If (hwnd = External) 
        WinSet, Top, , ahk_id %childGuiID2%   
}

SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags)
{
    return DllCall(&quot;SetWinEventHook&quot; , UInt, eventMin, UInt, eventMax
    , Ptr, hmodWinEventProc, Ptr, lpfnWinEventProc
    , UInt, idProcess, UInt, idThread
    , UInt, dwFlags, Ptr)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[samardac]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33189</uri>
			</author>
			<updated>2015-07-11T12:45:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95270#p95270</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95269#p95269" />
			<content type="html"><![CDATA[<p>serzh82saratov, второй вариант вроде как дает похожий результат как и первый. Но я заметил что нотепад активируется только при клике по шапке, во всех других случаях он снизу. В моей задаче вместа нотепада будет другое приложение, и шапка этого приложения будет скрыта, так что активировать окно не получится я уже протестил с первым скриптом и все вроде как работает, приложение всегда снизу, спасибо! <br />Спасибо за идею с EventHook.</p>]]></content>
			<author>
				<name><![CDATA[samardac]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33189</uri>
			</author>
			<updated>2015-07-11T12:32:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95269#p95269</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95267#p95267" />
			<content type="html"><![CDATA[<p>Если в некоторых ситуациях всё таки будет уходить на задний план, то ещё по добавлять <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd318066(v=vs.85).aspx">сообщений WinEventHook</a>.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-07-11T12:13:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95267#p95267</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95266#p95266" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>нотепад всерано активируется</p></blockquote></div><p>Ну он и должен активироватся, можно ещё попробовать добавить к нему стиль WS_EX_NOACTIVATE, но тогда скорее всего уже нельзя будет с ним взаимодействовать, и не всегда оно применяется.<br />Так ещё попробуйте:<br /></p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><div class="codebox"><pre><code>
#SingleInstance Force      
#Persistent 
#NoEnv
ListLines Off  
DetectHiddenWindows, On
SetWinEventHook(0x8005, 0x8005, 0, RegisterCallback(&quot;MyFunc&quot;, &quot;F&quot;),0,0,0) ; EVENT_OBJECT_FOCUS 
SetWinEventHook(0x800B, 0x800B, 0, RegisterCallback(&quot;MyFunc&quot;, &quot;F&quot;),0,0,0) ; EVENT_OBJECT_LOCATIONCHANGE
Gui, Main: +HwndmainGuiId  
Gui, Main: +LastFound  
Gui, Child2: +ParentMain +HwndchildGuiId2 +AlwaysOnTop
Gui, Child2: Add, Text,,this is child gui 
Run, Notepad,, Hide
WinWait, ahk_class Notepad
Global External := WinExist(&quot;ahk_class Notepad&quot;), childGuiID2 
DllCall(&quot;SetParent&quot;, &quot;uint&quot;, External, &quot;uint&quot;, mainGuiId) 
WinMove, ahk_id %External%, , 0,0 
WinShow, ahk_id %External%
Gui, Child2: Show, x100 y0 w300 h100, Child GUI 2
Gui, Main: Show, w600 h150 
WinSet, Top, , ahk_id %childGuiID2% 
 ; WinSet, ExStyle, +0x08000000, ahk_id %External%   ;  WS_EX_NOACTIVATE
return

MyFunc(hWinEventHook, event, hwnd) { 
    If (hwnd = External) 
        WinSet, Top, , ahk_id %childGuiID2%   
}

SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags)
{
   return DllCall(&quot;SetWinEventHook&quot; , UInt, eventMin, UInt, eventMax
                                    , Ptr, hmodWinEventProc, Ptr, lpfnWinEventProc
                                    , UInt, idProcess, UInt, idThread
                                    , UInt, dwFlags, Ptr)
}
</code></pre></div></div></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2015-07-11T12:06:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95266#p95266</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: AlwaysOnTop внутри Родителя]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=95264#p95264" />
			<content type="html"><![CDATA[<p>teadrinker,<br />в двух словах, есть приложение поверх которого делается новый интерфэйс. Этот новый интерфэйс должен всегда лежать поверх приложения. Для облегчения манипуляции с этими двумя окнами они помещаются в родительское окно. </p><p>serzh82saratov, <br />нотепад всерано активируется и выходит на первый план.</p>]]></content>
			<author>
				<name><![CDATA[samardac]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33189</uri>
			</author>
			<updated>2015-07-11T10:42:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=95264#p95264</id>
		</entry>
</feed>
