<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Pointers to Objects]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15302&amp;type=atom" />
	<updated>2020-04-22T18:39:27Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=15302</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139120#p139120" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Не могу понять как оставить объект действительным при выходе из создающего его процесса</p></blockquote></div><p>Не думаю, что это возможно таким способом, т. к. при завершении скрипта, где объект определён, он нигде не сохраняется.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-04-22T18:39:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139120#p139120</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139117#p139117" />
			<content type="html"><![CDATA[<p>Не могу понять как оставить объект действительным при выходе из создающего его процесса, чтобы при следующем запуске подключится к нему по прежнему CLSID.<br />Вроде как ACTIVEOBJECT_STRONG за это должен отвечать, RevokeActiveObject не используется. Про CoLockObjectExternal примеров не нашёл.</p><div class="codebox"><pre><code>
#SingleInstance Force
#NoEnv

; https://www.autohotkey.com/boards/viewtopic.php?t=6148
; https://docs.microsoft.com/ru-ru/windows/win32/api/oleauto/nf-oleauto-registeractiveobject?redirectedfrom=MSDN
; CoLockObjectExternal
  
If !A_Args[1]
	MsgBox % Clipboard := CreateGUID()

try myPublicObj := ComObjActive(Clipboard)
catch
	{ 
		MsgBox ComObjActive Error
		myPublicObj := {}
		ObjRegisterActive(myPublicObj, Clipboard, 0)
	}
MsgBox % &quot;Прежнее значение: &quot; myPublicObj.TickCount
MsgBox % &quot;Новое значение: &quot; myPublicObj.TickCount := A_TickCount 
Run &quot;%A_ScriptFullPath%&quot; &quot;Reload&quot;
ExitApp 

CreateGUID()
{
   VarSetCapacity(pguid, 16, 0)
   if !DllCall(&quot;ole32.dll\CoCreateGuid&quot;, Ptr, &amp;pguid)  {
      size := VarSetCapacity(sguid, (38 &lt;&lt; !!A_IsUnicode) + 1, 0)
      if DllCall(&quot;ole32.dll\StringFromGUID2&quot;, Ptr, &amp;pguid, Ptr, &amp;sguid, UInt, size)
         return StrGet(&amp;sguid)
   }
}

ObjRegisterActive(Object, CLSID = 0, Flags := 0) {
   static cookieJar := {}
   if !CLSID  {
      if (( cookie := cookieJar.Delete(Object) ) != &quot;&quot;)
         DllCall(&quot;oleaut32\RevokeActiveObject&quot;, UInt, cookie, Ptr, 0)
      return
   }
   if cookieJar[Object]
      throw Exception(&quot;Object is already registered&quot;, -1)
   VarSetCapacity(_clsid, 16, 0)
   if (hr := DllCall(&quot;ole32\CLSIDFromString&quot;, WStr, CLSID, Ptr, &amp;_clsid)) &lt; 0
      throw Exception(&quot;Invalid CLSID&quot;, -1, CLSID)
   hr := DllCall(&quot;oleaut32\RegisterActiveObject&quot;, Ptr, &amp;Object, Ptr, &amp;_clsid, UInt, Flags, UIntP, cookie, UInt)
   if hr &lt; 0
      throw Exception(format(&quot;Error 0x{:x}&quot;, hr), -1)
   cookieJar[Object] := cookie
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-04-22T13:43:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139117#p139117</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139053#p139053" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>или ты просто про адрес в памяти</p></blockquote></div><p>Про адрес.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2020-04-16T02:30:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139053#p139053</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139052#p139052" />
			<content type="html"><![CDATA[<p>Обычно SendMessage использую.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-04-15T21:38:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139052#p139052</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139051#p139051" />
			<content type="html"><![CDATA[<p>Или чтение памяти?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-04-15T21:19:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139051#p139051</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139050#p139050" />
			<content type="html"><![CDATA[<p>Данные через SendMessage&nbsp; отправляешь?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-04-15T21:19:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139050#p139050</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139049#p139049" />
			<content type="html"><![CDATA[<p>Не, я для реальных скриптов ни разу не пользовался, как и RegisterActiveObject, как-то не возникало необходимости.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-04-15T21:17:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139049#p139049</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139048#p139048" />
			<content type="html"><![CDATA[<p><strong>Alectric</strong><br />Тоже не нашёл с первого раза. <br />WSH и VBS переносятся проще всего, с AutoIt уже намного сложнее.</p><p><strong>teadrinker</strong><br />А ты сам этим пользуешься? По ссылке у тебя возник вопрос, и ещё:<br /></p><div class="quotebox"><cite>Xameleon пишет:</cite><blockquote><p><strong>2 Rumata:</strong> Да. Есть некоторые &quot;косяки&quot;. ) Связь с объектами пропадает не сразу. Как эти механизмы &quot;лечить&quot; надо подумать.</p><p>P.S Всё же HACK технология. <img src="//forum.script-coding.com/img/smilies/big_smile.png" width="15" height="15" /> Винда то и не думала, что её вывернут наизнанку и через её родные окошки будут данными кидаться.</p></blockquote></div><br /><div class="quotebox"><cite>Malcev пишет:</cite><blockquote><p>Про процессы тут почитай:</p></blockquote></div><p>Спасибо, прочитал, но не понял ход мысли, как это сможет сделать объект одинаково доступным, или ты просто про адрес в памяти.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-04-15T21:14:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139048#p139048</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139045#p139045" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alectric пишет:</cite><blockquote><p>На изучение исполнений на других языках да еще и на последующую конвертацию на AHK у меня не остается сил после работы</p></blockquote></div><p>Но ведь всегда можно спросить/попросить об этом на AHK форумах.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2020-04-15T18:56:55Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139045#p139045</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139044#p139044" />
			<content type="html"><![CDATA[<p>OFF:<br />На изучение исполнений на других языках да еще и на последующую конвертацию на AHK у меня не остается сил после работы. На работе языков хватает: STL, SCL, LAD, FBD.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2020-04-15T18:27:33Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139044#p139044</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139043#p139043" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alectric пишет:</cite><blockquote><p>Меня лично интересует только AHK</p></blockquote></div><p>И зря. Так как, много чего полезного и не очень пройдет мимо вас.<br />Для достижения цели, стоит искать на любом языке, а потом уже переводить полученное на ahk.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2020-04-15T18:22:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139043#p139043</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139042#p139042" />
			<content type="html"><![CDATA[<p>OFF:<br />Конфуз. Для чего тогда придумали на форуме эти разграничения в виде &quot;AHK:&quot;, &quot;JS:&quot;, &quot;WSH:&quot; и т.д.<br />Меня лично интересует только AHK, потому и не захожу в темы где указано &quot;WSH:&quot; и прочее.<br />Откуда бы я узнал что там есть пример для AHK, тема то для WSH. <span style="color: #eeeeee">Подгорает немного от такого.</span></p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2020-04-15T18:12:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139042#p139042</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139039#p139039" />
			<content type="html"><![CDATA[<p><a href="http://forum.script-coding.com/viewtopic.php?pid=113561#p113561">Пример</a> на AHK.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-04-15T16:34:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139039#p139039</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139038#p139038" />
			<content type="html"><![CDATA[<p>Я искал только AHK. Даже и не думал в WSH залезть.</p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2020-04-15T14:56:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139038#p139038</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Pointers to Objects]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139037#p139037" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alectric пишет:</cite><blockquote><p>На нашем форуме такого не нашел.</p></blockquote></div><p>Странно. Вроде бы поиск у всех должен одинаково работать.<br />Ищется через гугл по слову GlobalContainer.<br /><a href="http://forum.script-coding.com/viewtopic.php?id=5573">http://forum.script-coding.com/viewtopic.php?id=5573</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2020-04-15T14:21:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139037#p139037</id>
		</entry>
</feed>
