<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: MsgBox - положение окна на экране]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=6424</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6424&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: MsgBox - положение окна на экране».]]></description>
		<lastBuildDate>Mon, 21 Nov 2011 10:57:40 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: MsgBox - положение окна на экране]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=53744#p53744</link>
			<description><![CDATA[<div class="quotebox"><cite>Александр_ пишет:</cite><blockquote><p>Нужно поставить локальный хук на WH_CBT...</p></blockquote></div><p>Спасибо, логично.<br /></p><div class="quotebox"><cite>Александр_ пишет:</cite><blockquote><p>Лучше всё-таки своё окно сделать <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p></blockquote></div><p>Мне тоже показалось, что проще.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Mon, 21 Nov 2011 10:57:40 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=53744#p53744</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: MsgBox - положение окна на экране]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=53726#p53726</link>
			<description><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>Получается, что FindWindow() находит окно раньше, чем оно появляется на экране, в отличие от WinExist()?</p></blockquote></div><p>Как повезёт. Если успеет отработать в промежутке между созданием окна и вызовом ShowWindow, то прокатит <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> .<br />Ну вообще не хорошо таймерами кидаться- не надёжно и систему напрягает. Нужно поставить локальный хук на WH_CBT и обрабатывать код LPCBT_CREATEWND. В lParam будет ссылка на структуру CBT_CREATEWND, в которой будет ссылка структуру CREATESTRUCT, в которой будут данные о положении окна, которые можно подменить. Ссылка на имя класса в этой структуре скорее всего будет невалидной, это отмечено в документации, поэтому нужно его отдельно получать.<br /></p><div class="codebox"><pre><code>hhook:=DllCall(&quot;SetWindowsHookEx&quot;, &quot;int&quot;, 5, &quot;uint&quot;, RegisterCallback(&quot;HookProc&quot;, &quot;&quot;, 3), &quot;uint&quot;, 0, &quot;uint&quot;, DllCall(&quot;GetCurrentThreadId&quot;, &quot;uint&quot;), &quot;uint&quot;)
msgbox 111111111111111
msgbox 222222222222222
DllCall(&quot;UnhookWindowsHookEx&quot;, &quot;uint&quot;, hhook)
ExitApp
return

HookProc(code,wParam,lParam)
{
	if (code=3) ;если создаётся создаётся
	{
	   VarSetCapacity(Class, 14, 0) ; память под имя класса окна
	   DllCall(&quot;GetClassName&quot;, &quot;uint&quot;, wParam, &quot;uint&quot;, &amp;Class, &quot;uint&quot;, 7) ;получаем имя класса
	   ClassName:=StrGet(&amp;Class, 6) ;можно длину не указывать, строка с нулём на конце
	   if (ClassName=&quot;#32770&quot;) ;если MessageBox
	   {
	      NumPut(0,NumGet(lParam|0), 24) ;игрек
		  NumPut(0,NumGet(lParam|0), 28) ;икс
	   }
	}
	return DllCall(&quot;CallNextHookEx&quot;, &quot;uint&quot;, hhook, &quot;uint&quot;, code, &quot;uint&quot;, wParam, &quot;uint&quot;, lParam)
}</code></pre></div><p>P.S. Лучше всё-таки своё окно сделать <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (Александр_)]]></author>
			<pubDate>Sun, 20 Nov 2011 23:47:05 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=53726#p53726</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: MsgBox - положение окна на экране]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=53704#p53704</link>
			<description><![CDATA[<p>Хотя и просто так получается:<br /></p><div class="codebox"><pre><code>SetTimer, ChangePos, 1
MsgBox,, Заголовок, Текст
Return

ChangePos:
   DetectHiddenWindows, On
   if !hMsgBox := WinExist(&quot;Заголовок ahk_class #32770&quot;)
      Return
      
   WinMove, ahk_id %hMsgBox%,, 100, 100
   SetTimer, ChangePos, Off
   Return</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 20 Nov 2011 10:49:23 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=53704#p53704</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: MsgBox - положение окна на экране]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=53702#p53702</link>
			<description><![CDATA[<p>Спасибо, интересно! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /> Только заголовок у него не появился.<br />То-есть, просто сменить позицию можно так:</p><div class="codebox"><pre><code>SetTimer, ChangePos, 1
MsgBox,, Заголовок, Текст
Return

ChangePos:
   if !hMsgBox:=DllCall(&quot;FindWindow&quot;, Str, &quot;#32770&quot;, Str, &quot;Заголовок&quot;)
      Return
      
   DllCall(&quot;SetWindowPos&quot;, UInt, hMsgBox, UInt, 0, Int, 100, Int, 100, Int, 0, Int, 0, UInt, SWP_NOSIZE := 1)
   SetTimer, ChangePos, Off
   Return</code></pre></div><p>Получается, что <em>FindWindow()</em> находит окно раньше, чем оно появляется на экране, в отличие от <em>WinExist()</em>?</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sun, 20 Nov 2011 10:09:12 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=53702#p53702</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: MsgBox - положение окна на экране]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=53688#p53688</link>
			<description><![CDATA[<p>Немного баловства <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />:</p><div class="codebox"><pre><code>#NoTrayIcon
SetBatchLines, -1
Str:=&quot;Бегущая строка... &quot;
StrLenght:=StrLen(Str)
SetTimer, ChangeMsgBox, 1
MsgBox,0x40004,Видоизменённый MsgBox,
SetTimer, ScrollText,Off
ExitApp

ChangeMsgBox:
if !(hMsgBox:=DllCall(&quot;FindWindow&quot;,&quot;str&quot;,&quot;#32770&quot;,&quot;str&quot;,&quot;Видоизменённый MsgBox&quot;))
return
SetTimer, ChangeMsgBox, Off
DllCall(&quot;SetWindowLong&quot;,&quot;uint&quot;,hMsgBox,&quot;int&quot;,-20,&quot;uint&quot;,DllCall(&quot;GetWindowLong&quot;,&quot;uint&quot;,hMsgBox,&quot;int&quot;,-20)|WS_EX_TOOLWINDOW:=0x80) ; ???
DllCall(&quot;SetWindowLong&quot;,&quot;uint&quot;,hMsgBox,&quot;int&quot;,-16,&quot;uint&quot;,DllCall(&quot;GetWindowLong&quot;,&quot;uint&quot;,hMsgBox,&quot;int&quot;,-16)^WS_CAPTION:=0xC00000)
DllCall(&quot;SetWindowPos&quot;,&quot;uint&quot;,hMsgBox,&quot;uint&quot;,0,&quot;int&quot;,A_ScreenWidth/3,&quot;int&quot;,A_ScreenHeight/2-120,&quot;int&quot;,A_ScreenWidth/3,&quot;int&quot;,240,&quot;uint&quot;,0x40)
ControlGet, hbt1, Hwnd,,Button1, ahk_id %hMsgBox%
ControlGet, hbt2, Hwnd,,Button2, ahk_id %hMsgBox%
DllCall(&quot;SetWindowPos&quot;,&quot;uint&quot;,hbt1,&quot;uint&quot;,0,&quot;int&quot;,-3,&quot;int&quot;,208-3,&quot;int&quot;,A_ScreenWidth/6,&quot;int&quot;,30,&quot;uint&quot;,0x40)
DllCall(&quot;SetWindowPos&quot;,&quot;uint&quot;,hbt2,&quot;uint&quot;,0,&quot;int&quot;,A_ScreenWidth/6-3,&quot;int&quot;,208-3,&quot;int&quot;,A_ScreenWidth/6,&quot;int&quot;,30,&quot;uint&quot;,0x40)
SetTimer, ScrollText,250
Return

ScrollText:
StartPos += StartPos&lt;StrLenght ? 1 : -StrLenght+1
ScrlText:=SubStr(Str,StartPos) . SubStr(Str,1,StartPos)
DllCall(&quot;SendMessage&quot;,&quot;uint&quot;,hbt2,&quot;uint&quot;,0xC,&quot;uint&quot;,0,&quot;uint&quot;,&amp;ScrlText)
Return

/*
SWP_SHOWWINDOW   = 0x40
WM_SETTEXT       = 0xC
*/</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (kirtech)]]></author>
			<pubDate>Sat, 19 Nov 2011 17:10:47 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=53688#p53688</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: MsgBox - положение окна на экране]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=53398#p53398</link>
			<description><![CDATA[<p>Ясно, спасибо!</p>]]></description>
			<author><![CDATA[null@example.com (Bobby)]]></author>
			<pubDate>Thu, 10 Nov 2011 08:42:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=53398#p53398</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: MsgBox - положение окна на экране]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=53397#p53397</link>
			<description><![CDATA[<p>Посредством AHK — никак, но можно создать своё окно вместо MsgBox.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 10 Nov 2011 08:26:36 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=53397#p53397</guid>
		</item>
		<item>
			<title><![CDATA[AHK: MsgBox - положение окна на экране]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=53389#p53389</link>
			<description><![CDATA[<p>Есть ли способ вывода окна сообщения MsgBox не в центре, как по умолчанию, а в нужном месте?<br />&nbsp; &nbsp; &nbsp;Можно, конечно, переместить окно по команде WinMove, но хотелось бы, чтобы окно появлялось сразу в нужном месте.</p>]]></description>
			<author><![CDATA[null@example.com (Bobby)]]></author>
			<pubDate>Thu, 10 Nov 2011 04:51:41 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=53389#p53389</guid>
		</item>
	</channel>
</rss>
