<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS:Не получается подключить COM объект.]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13510&amp;type=atom" />
	<updated>2018-04-09T21:47:08Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=13510</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS:Не получается подключить COM объект.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=124571#p124571" />
			<content type="html"><![CDATA[<p><strong>dmitrich-07</strong>, боюсь не смогу Вам помочь с Net кодом. Как я уже говорил, об этом лучше спросить на <strong>bbs.vbstreets.ru</strong>.</p>]]></content>
			<author>
				<name><![CDATA[Xameleon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=8836</uri>
			</author>
			<updated>2018-04-09T21:47:08Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=124571#p124571</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:Не получается подключить COM объект.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=124558#p124558" />
			<content type="html"><![CDATA[<p>Спасибо за ответ!<br />Решил все таки на vb.net замутить, и столкнулся с проблемой.&nbsp; Проблема значит следующая: <br />Пытаюсь использовать метод GetAbonentState, для того, чтобы получить состояние абонентов. Попробовал следующий код:</p><div class="codebox"><pre><code>Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Dim abonents As New ICmtControl
        Dim pdwCount As UInteger
        Dim savep As New SABONENT_STATE
        Dim ppAbonentState As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(savep))
        abonents.GetAbonentState(pdwCount, ppAbonentState)
        savep = CType(Marshal.PtrToStructure(ppAbonentState, GetType(SABONENT_STATE)), SABONENT_STATE)
        TextBox9.Text = savep.Name
    End Sub</code></pre></div><p>В результате в tetxtbox выводит иероглифы не читаемые. В общем метод GetAbonentState возвращает кол-во абонентов и указатель на массив структур, помогите разобраться с этим указателем?<br />Спасибо!</p>]]></content>
			<author>
				<name><![CDATA[dmitrich-07]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39111</uri>
			</author>
			<updated>2018-04-09T13:15:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=124558#p124558</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:Не получается подключить COM объект.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123950#p123950" />
			<content type="html"><![CDATA[<p><strong>dmitrich-07</strong>, поизучал библиотечку. Не совсем она подходит для VBS и JS. Я далеко не хороший знаток архитектуры COM, но по моему представлению дело в том, что созданный объект возвращает интерфейс <strong>IUnknown</strong>&nbsp; и все методы имеют формат вызова <strong>stdcall</strong>,<br />а по правилам работы COM должен возвращатcя интерфейс <strong>IDispatch</strong> + <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms221464(v=vs.85).aspx">dual</a>, который после перебора отдаст указатель на необходимый метод / свойство.</p><p>Для сравнения сделал скриншоты отображения <strong>FileSystemObject</strong> и Вашего объекта в <strong>oleview</strong> и отметил места, о которых говорил.</p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header" data-lang-open="открыть спойлер" data-lang-close="скрыть спойлер"><strong>+</strong>&nbsp;открыть спойлер</div><div class="fancy_spoiler"><p><span class="postimg"><img src="https://i.imgur.com/yIU6UuZ.jpg" alt="https://i.imgur.com/yIU6UuZ.jpg" /></span><br /><span class="postimg"><img src="https://i.imgur.com/DdbPG9O.jpg" alt="https://i.imgur.com/DdbPG9O.jpg" /></span></p></div></div><p>Предполагаю, что возможно пересобрать TLB для этой DLL таким образом, чтобы она штатно работала и в скриптах, но к сожалению сам с этим мало помогу. Скорее всего Вам стоит спросить об этом на <a href="http://bbs.vbstreets.ru">bbs.vbstreets.ru</a></p><p>P.S Либо можно сделать wrapper на NET. )</p>]]></content>
			<author>
				<name><![CDATA[Xameleon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=8836</uri>
			</author>
			<updated>2018-03-06T09:38:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123950#p123950</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:Не получается подключить COM объект.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123948#p123948" />
			<content type="html"><![CDATA[<p><strong>Xameleon</strong><br />Да и еще, в vb.net следующий код работает на ура<br /></p><div class="codebox"><pre><code>Imports cmtLib
Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click, Button2.Click
        Dim Start As New CmtControl, pError As Integer, pErrorDescription As String

        Start.Start(pError, pErrorDescription)

    End Sub
End Class</code></pre></div>]]></content>
			<author>
				<name><![CDATA[dmitrich-07]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39111</uri>
			</author>
			<updated>2018-03-06T05:00:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123948#p123948</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:Не получается подключить COM объект.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123947#p123947" />
			<content type="html"><![CDATA[<p>Сама dll забыл прикрепить!)</p>]]></content>
			<author>
				<name><![CDATA[dmitrich-07]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39111</uri>
			</author>
			<updated>2018-03-06T04:48:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123947#p123947</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:Не получается подключить COM объект.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123946#p123946" />
			<content type="html"><![CDATA[<p>1) dll прикрепил<br />2) Да, имелось ввиду при запуске скрипта, выдает ошибку &quot;требуется объект&quot;</p>]]></content>
			<author>
				<name><![CDATA[dmitrich-07]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39111</uri>
			</author>
			<updated>2018-03-06T04:45:56Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123946#p123946</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS:Не получается подключить COM объект.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123927#p123927" />
			<content type="html"><![CDATA[<p><strong>dmitrich-07</strong>, <br />1) А можно &quot;пощупать&quot; cmt.dll в живую ?<br />2) О какой &quot;компиляции&quot; идёт речь ? Вы имели в виду при запуске скрипта и его &quot;интерпретации&quot; или я неправильно Вас понял ?</p>]]></content>
			<author>
				<name><![CDATA[Xameleon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=8836</uri>
			</author>
			<updated>2018-03-05T15:06:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123927#p123927</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBS:Не получается подключить COM объект.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=123921#p123921" />
			<content type="html"><![CDATA[<p>Добрый день!<br />Есть com сервер cmt.dll, библиотека в реестре зарегистрирована, OLE/View на скрине<br />Пытаюсь добраться до метода &quot;Start&quot; смотреть скрин.<br />Код следующий:<br />Строка 1 - Dim a<br />Строка 2 - Set a=CreateObject(&quot;cmt.CmtControl&quot;)<br />Строка 3 - a.Start()<br />При компиляции выдает ошибку &quot;Требуется объект&quot; строка 3, символ 2. Подскажите что неправильно делаю?</p>]]></content>
			<author>
				<name><![CDATA[dmitrich-07]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=39111</uri>
			</author>
			<updated>2018-03-05T13:57:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=123921#p123921</id>
		</entry>
</feed>
