<?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=14362&amp;type=atom" />
	<updated>2018-11-29T22:58:26Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14362</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как узнать толщину рамки окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130130#p130130" />
			<content type="html"><![CDATA[<p>Нужно смотреть описание параметров:<br /></p><div class="codebox"><pre><code>SysGet, captionHeight, % SM_CYCAPTION := 4
MsgBox, % captionHeight

; Для окна без ресайзинга
SysGet, frameWidth, % SM_CXFIXEDFRAME := 7
SysGet, frameHeight, % SM_CYFIXEDFRAME := 8
MsgBox, % frameWidth

; Для окна с ресайзингом
SysGet, frameWidth, % SM_CXSMSIZE := 32
SysGet, frameHeight, % SM_CYSMSIZE := 33

MsgBox, % frameWidth</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-11-29T22:58:26Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130130#p130130</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как узнать толщину рамки окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130129#p130129" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong></p><p>Спасибо большое. Очень сильно помог.<br />Я просто в ahk пока не сильно силён, что бы писать такие функции, но я учусь <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><p>И всё же, как с помощью SysGet найди толщину рамки и заголовка?<br />Просто я уже пытался решить проблему через это, но почему то не получалось.</p><p>Заранее спасибо!</p>]]></content>
			<author>
				<name><![CDATA[Jew]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39655</uri>
			</author>
			<updated>2018-11-29T22:40:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130129#p130129</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как узнать толщину рамки окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130127#p130127" />
			<content type="html"><![CDATA[<p>Проще сразу получить экранные координаты клиентской части окна:<br /></p><div class="codebox"><pre><code>Run, notepad,,, PID
WinWait, ahk_pid %PID%
pos := WinGetClientPos(&quot;ahk_pid&quot; PID)
MsgBox, % &quot;x = &quot; . pos.x . &quot;`n&quot;
        . &quot;y = &quot; . pos.y . &quot;`n&quot;
        . &quot;w = &quot; . pos.w . &quot;`n&quot;
        . &quot;h = &quot; . pos.h

WinGetClientPos(winTitle)  {
   if !hWnd := WinExist(winTitle)  {
      MsgBox, winTitle is wrong
      Return
   }
   VarSetCapacity(WINDOWINFO, 60, 0)
   DllCall(&quot;GetWindowInfo&quot;, Ptr, hWnd, Ptr, &amp;WINDOWINFO)
   Return { x: x := NumGet(WINDOWINFO, 20, &quot;UInt&quot;)
          , y: y := NumGet(WINDOWINFO, 24, &quot;UInt&quot;)
          , w: NumGet(WINDOWINFO, 28, &quot;UInt&quot;) - x
          , h: NumGet(WINDOWINFO, 32, &quot;UInt&quot;) - y }
}</code></pre></div><p>Толщину рамок и заголовка можно получать командой SysGet, но в некоторых случаях они не соответствуют видимым размерам.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-11-29T22:21:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130127#p130127</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как узнать толщину рамки окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130126#p130126" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong></p><p>Я использую клиентскую часть окна через CoordMode, но функция WinGetPos использует координаты всего окна.<br />(К примеру: клиентская часть имеет разрешение 800х600, но окно с рамкой 816x638)</p><p>Для чего мне это надо?<br />1. Делать скриншот активного окна<br /></p><div class="codebox"><pre><code>
; Источник: http://forum.script-coding.com/viewtopic.php?pid=121790#p121790
...
WinGetPos, X, Y, Width, Height, ahk_pid %PID_Process%
SaveScreenshotToFile(X+3, Y+25, Width-3, Height-3, A_ScriptDir . &quot;\test.png&quot;)
...
</code></pre></div><p>2. Рисовать границы с помощью Splashimage.<br /></p><div class="codebox"><pre><code>
;~ Где:
;~ r_X	:= %A_LoopField%.1 ; координата Х относительно клиентской части
;~ r_Y	:= %A_LoopField%.2 ; координата Y относительно клиентской части
;~ r_W	:= %A_LoopField%.3 ; координата W относительно клиентской части
;~ r_H  := %A_LoopField%.4 ; координата H относительно клиентской части

WinGetPos, p_X, p_Y, p_W, p_H, ahk_pid %PID_Process% ; найди длину,ширину и местоположение окна
Splashimage 1:,% &quot;CWFFFF00 B1 W&quot; r_W-r_X   &quot;H1 X&quot; p_X+r_X+3 &quot;Y&quot; p_Y+r_Y+25
Splashimage 2:,% &quot;CWFFFF00 B1 W&quot; r_W-r_X   &quot;H1 X&quot; p_X+r_X+3 &quot;Y&quot; p_Y+r_H+25
Splashimage 3:,% &quot;CWFFFF00 B1 H&quot; r_H-r_Y     &quot;W1 X&quot; p_X+r_X+3 &quot;Y&quot; p_Y+r_Y+25
Splashimage 4:,% &quot;CWFFFF00 B1 H&quot; r_H-r_Y+1 &quot;W1 X&quot; p_X+r_W+3 &quot;Y&quot; p_Y+r_Y+25
</code></pre></div><p>(Появляются относительно рабочего стола, а не окна или его клиентской части)</p>]]></content>
			<author>
				<name><![CDATA[Jew]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39655</uri>
			</author>
			<updated>2018-11-29T20:50:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130126#p130126</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Как узнать толщину рамки окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130125#p130125" />
			<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>2018-11-29T20:22:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130125#p130125</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Как узнать толщину рамки окна?]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=130122#p130122" />
			<content type="html"><![CDATA[<p>Доброго дня!<br />Как узнать длину(толщину, размер) левой, верхней, правой и нижней части сторон активного окна?<br />Прикрепил скриншот</p><p>Искал в интернете, но ничего не нашёл!</p><p>В документации на офф сайте ahk нашёл только это:<br />(Проблема в лишь том, что он рассматривается относительно рабочего стола, а не клиентской части окна)<br /></p><div class="codebox"><pre><code>
; Источник: https://www.autohotkey.com/docs/commands/DllCall.htm
; Structure Example: Pass the address of a RECT structure to GetWindowRect(), which sets the structure&#039;s
; members to the positions of the left, top, right, and bottom sides of a window (relative to the screen).

Run Notepad
WinWait Untitled - Notepad  ; This also sets the &quot;last found window&quot; for use with WinExist() below.
VarSetCapacity(Rect, 16)  ; A RECT is a struct consisting of four 32-bit integers (i.e. 4*4=16).
DllCall(&quot;GetWindowRect&quot;, Ptr, WinExist(), Ptr, &amp;Rect)  ; WinExist() returns an HWND.
MsgBox % &quot;Left &quot; . NumGet(Rect, 0, &quot;Int&quot;) . &quot; Top &quot; . NumGet(Rect, 4, &quot;Int&quot;)
    . &quot; Right &quot; . NumGet(Rect, 8, &quot;Int&quot;) . &quot; Bottom &quot; . NumGet(Rect, 12, &quot;Int&quot;)
</code></pre></div><p><a href="https://radikal.ru"><span class="postimg"><img src="https://d.radikal.ru/d10/1811/b8/887f4a0741c0.jpg" alt="https://d.radikal.ru/d10/1811/b8/887f4a0741c0.jpg" /></span></a></p>]]></content>
			<author>
				<name><![CDATA[Jew]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39655</uri>
			</author>
			<updated>2018-11-29T19:33:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=130122#p130122</id>
		</entry>
</feed>
