<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: RegisterCallback() и количество параметров]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=17403</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17403&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: RegisterCallback() и количество параметров».]]></description>
		<lastBuildDate>Fri, 07 Oct 2022 16:16:49 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: RegisterCallback() и количество параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=155116#p155116</link>
			<description><![CDATA[<div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>И если функция уберет 1 параметр вместо 2, то чем это чревато?</p></blockquote></div><p>Зависит от того, как код скомпилировался. Может, и ничего. Смотря от чего, например, адресуются локальные переменные, они ведь хранятся в стеке. Если от указателя стека, то он после вызова окажется не там, где был до вызова, и адресация собьётся.</p><div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>А почему на 64 битах такой ситуации не наблюдается?</p></blockquote></div><p>Там соглашение вызова fastcall, где стек очищает вызывающая функция. Сколько положила, столько и уберёт.</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Fri, 07 Oct 2022 16:16:49 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=155116#p155116</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegisterCallback() и количество параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=155112#p155112</link>
			<description><![CDATA[<p>А почему на 64 битах такой ситуации не наблюдается?<br />И если функция уберет 1 параметр вместо 2, то чем это чревато?</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Fri, 07 Oct 2022 15:48:52 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=155112#p155112</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegisterCallback() и количество параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=155086#p155086</link>
			<description><![CDATA[<p>Вызванная функция должна сама очищать стек от своих параметров (если соглашение вызова stdcall). Фактически в стеке 2 параметра, а функция уберёт 5, т.е. удалит лишнее.</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Fri, 07 Oct 2022 02:18:36 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=155086#p155086</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegisterCallback() и количество параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=155082#p155082</link>
			<description><![CDATA[<p>Да, в этом случае функция просто крашится:<br /></p><div class="codebox"><pre><code>counter := 0
EnumAddress := RegisterCallback(&quot;EnumWindowsProc&quot;, &quot;Fast&quot;)
MsgBox, % DllCall(&quot;EnumWindows&quot;, &quot;Ptr&quot;, EnumAddress, &quot;Ptr&quot;, 0)
MsgBox %Output%  ; Display the information accumulated by the callback.
    
EnumWindowsProc(hwnd, lParam, a, b, c)   ; 5 параметров вместо 2
{
    global Output, counter
    ToolTip % ++counter
    WinGetClass, class, ahk_id %hwnd%
    WinGetTitle, title, ahk_id %hwnd%
    
    if title
        Output .= &quot;HWND: &quot; . hwnd . &quot;`tTitle: &quot; . title . &quot;`tClass: &quot; . class . &quot;`n&quot;
    return true  ; Tell EnumWindows() to continue until all windows have been enumerated.
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 06 Oct 2022 20:35:10 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=155082#p155082</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegisterCallback() и количество параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=155081#p155081</link>
			<description><![CDATA[<p>Сейчас проверил код из первого поста на 32бит и если параметров больше, то выводит пустоту.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Thu, 06 Oct 2022 19:57:23 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=155081#p155081</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegisterCallback() и количество параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=155080#p155080</link>
			<description><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>иначе просто интерпретатор выдаст ошибку</p></blockquote></div><p>Проверил, не выдаёт. Просто не сработает:<br /></p><div class="codebox"><pre><code>EnumAddress := RegisterCallback(&quot;EnumWindowsProc&quot;, &quot;Fast&quot;, 3)
DllCall(&quot;EnumWindows&quot;, &quot;Ptr&quot;, EnumAddress, &quot;Ptr&quot;, 0)
MsgBox %Output%  ; Display the information accumulated by the callback.
    
EnumWindowsProc(hwnd, lParam)
{
    global Output
    WinGetTitle, title, ahk_id %hwnd%
    WinGetClass, class, ahk_id %hwnd%
    if title
        Output .= &quot;HWND: &quot; . hwnd . &quot;`tTitle: &quot; . title . &quot;`tClass: &quot; . class . &quot;`n&quot;
    return true  ; Tell EnumWindows() to continue until all windows have been enumerated.
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 06 Oct 2022 19:47:48 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=155080#p155080</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: RegisterCallback() и количество параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=155079#p155079</link>
			<description><![CDATA[<p>В данном случае ничем, лишние просто не будут приходить. Наверно, имеется в виду, что если указано количество, то должно быть правильным, иначе просто интерпретатор выдаст ошибку.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 06 Oct 2022 19:42:04 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=155079#p155079</guid>
		</item>
		<item>
			<title><![CDATA[AHK: RegisterCallback() и количество параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=155078#p155078</link>
			<description><![CDATA[<p>В справке написано, что при создании колбека нужно убедиться, что количество параметров у вызова и принимающей функции должны совпадать.<br />А почему не написано.<br />Чем теоретически может обернуться если их количество совпадать не будет?<br />Например:<br /></p><div class="codebox"><pre><code> EnumAddress := RegisterCallback(&quot;EnumWindowsProc&quot;, &quot;Fast&quot;)
DllCall(&quot;EnumWindows&quot;, &quot;Ptr&quot;, EnumAddress, &quot;Ptr&quot;, 0)
MsgBox %Output%  ; Display the information accumulated by the callback.
    
EnumWindowsProc(hwnd, lParam, temp1, temp2, temp3)   ; 5 параметров вместо 2
{
    global Output
    WinGetTitle, title, ahk_id %hwnd%
    WinGetClass, class, ahk_id %hwnd%
    if title
        Output .= &quot;HWND: &quot; . hwnd . &quot;`tTitle: &quot; . title . &quot;`tClass: &quot; . class . &quot;`n&quot;
    return true  ; Tell EnumWindows() to continue until all windows have been enumerated.
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Thu, 06 Oct 2022 19:17:21 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=155078#p155078</guid>
		</item>
	</channel>
</rss>
