<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Подружить DllCall и SendMessage]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6598&amp;type=atom" />
	<updated>2011-12-25T15:00:40Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6598</id>
		<entry>
			<title type="html"><![CDATA[AHK: Подружить DllCall и SendMessage]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=54960#p54960" />
			<content type="html"><![CDATA[<p>Имеется скрипт с использованием библиотеки AHKCtrlSupport.dll для создания в окне GUI дополнительных контролов.<br />Встроен обработчик событий для этих контролов:<br /></p><div class="codebox"><pre><code>OnMessage(0x002B, &quot;ProcessMsg&quot;)
OnMessage(0x000F, &quot;ProcessMsg&quot;)
OnMessage(0x000B, &quot;ProcessMsg&quot;)
OnMessage(0x0400, &quot;ProcessMsg&quot;)
ProcessMsg(wp, lp, msg)
{
    ;ToolTip, Msg:%msg% - lp:%lp% - wp:%wp%
    nRC := DllCall(&quot;AHKCtrlSupport\ProcessMsg&quot;, int, msg, int, wp, int, lp, &quot;Cdecl Int&quot;)
    if (errorlevel &lt;&gt; 0) || (nRC = 0)
    {
        MsgBox ошибка вызова ProcessMsg Errorlevel: %errorlevel% - RC: %nRC%
        return
    }
}</code></pre></div><p>Работает великолепно до тех пор, пока в том же скрипте не начинаю использовать команду <br /></p><div class="codebox"><pre><code>SendMessage,0xB0,&amp;Start,&amp;End,,ahk_id %MyEditID%</code></pre></div><p>К слову, команда используется для стандартного контрола, но суть в другом.<br />Последовательное выполнение (по ходу действия) сначала этой команды, затем обработчика вызывает ошибку<br /></p><div class="codebox"><pre><code>Error: This DllCall requires a prior VarSetCapacity. The program is now unstable and will exit.

    Line#
    117: MsgBox,ошибка вызова CreateHTMLStatic Errorlevel: %errorlevel% - RC: %LEDStaticHWND%
    118: Return
    119: }
    130: nRC := DllCall(&quot;AHKCtrlSupport\Redraw&quot;, &quot;Cdecl Int&quot;)
    131: Return
    134: {
    135: VarSetCapacity(lp, 10240000)  
---&gt;    137: nRC := DllCall(&quot;AHKCtrlSupport\ProcessMsg&quot;, int, msg, int, wp, int, lp, &quot;Cdecl Int&quot;)
    138: if (errorlevel &lt;&gt; 0) || (nRC = 0)  
    139: {
    140: MsgBox,ошибка вызова ProcessMsg Errorlevel: %errorlevel% - RC: %nRC%
    141: Return
    142: }
    143: }
    145: Return

---------------------------
ОК   
---------------------------</code></pre></div><p>Вот с чем с чем, а с командой VarSetCapacity не дружу. Как ее тут правильно выставить, чтобы программа не материлась?<br />Варианты уже попробовал разные - не вытанцовывается.</p>]]></content>
			<author>
				<name><![CDATA[pant-79]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=960</uri>
			</author>
			<updated>2011-12-25T15:00:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=54960#p54960</id>
		</entry>
</feed>
