<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=269168&amp;view=findpost&amp;p=2241598</guid>
        <pubDate>Mon, 13 Apr 2009 09:28:39 +0000</pubDate>
        <title>OLE Automation, в Visual C не срабатывает</title>
        <link>https://forum.sources.ru/index.php?showtopic=269168&amp;view=findpost&amp;p=2241598</link>
        <description><![CDATA[shadowbolt: Заработало через #import (пару функций пришлось переименовать):<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">Sh4Ole::ISH4OlePtr obj;</div><div class="code_line">obj.CreateInstance(L&quot;Sh4Ole.SH4App&quot;); &nbsp; </div><div class="code_line">obj-&#62;DBLogin(); //тут вылазит окошко</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
<br>
Но мне категорически не понятно, почему в первом варианте CreateDispatch не срабатывает???<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">ISH4Ole sh4; </div><div class="code_line">if (!sh4.CreateDispatch(&quot;Sh4Ole.SH4App&quot;))</div><div class="code_line">&nbsp;&nbsp; &nbsp;{ </div><div class="code_line">&nbsp;&nbsp; AfxMessageBox(&quot;Sh4Ole не найден.&quot;); </div><div class="code_line">&nbsp;&nbsp; return; </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div></ol></div></div></div></div>]]></description>
        <author>shadowbolt</author>
        <category>Visual C++ / MFC / WTL</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=269168&amp;view=findpost&amp;p=2239583</guid>
        <pubDate>Thu, 09 Apr 2009 20:57:27 +0000</pubDate>
        <title>OLE Automation, в Visual C не срабатывает</title>
        <link>https://forum.sources.ru/index.php?showtopic=269168&amp;view=findpost&amp;p=2239583</link>
        <description><![CDATA[v_klad: <strong class='tag-b'>shadowbolt</strong><div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>но в импортируемых функциях была ошибка</div></div><br>
Посмотри что за ошибки, может конфликтуют имена. Поиграйся с директивой #import.]]></description>
        <author>v_klad</author>
        <category>Visual C++ / MFC / WTL</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=269168&amp;view=findpost&amp;p=2239463</guid>
        <pubDate>Thu, 09 Apr 2009 16:10:37 +0000</pubDate>
        <title>OLE Automation, в Visual C не срабатывает</title>
        <link>https://forum.sources.ru/index.php?showtopic=269168&amp;view=findpost&amp;p=2239463</link>
        <description><![CDATA[shadowbolt: To <strong class='tag-b'>v_klad</strong>: сначала я так и начал делать, но в импортируемых функциях была ошибка, когда я закоментировал ошибочные функции в tli и tlh, то студия сообщает что: &quot;The file has been modified outside of the source editor. Do you want to reload it?&quot;. Если перезагружаю - то ошибка возвращается, если нет - то ругается на те же ошибки, как будто они не закоментированны.<br>
<br>
To <strong class='tag-b'>Бублик</strong>: Замена AfxOleInit()  на CoInitialize() - CoUninitialize() никак не помогла.]]></description>
        <author>shadowbolt</author>
        <category>Visual C++ / MFC / WTL</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=269168&amp;view=findpost&amp;p=2239029</guid>
        <pubDate>Thu, 09 Apr 2009 00:04:38 +0000</pubDate>
        <title>OLE Automation, в Visual C не срабатывает</title>
        <link>https://forum.sources.ru/index.php?showtopic=269168&amp;view=findpost&amp;p=2239029</link>
        <description><![CDATA[Бублик: CoInitialize() - CoUninitialize()]]></description>
        <author>Бублик</author>
        <category>Visual C++ / MFC / WTL</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=269168&amp;view=findpost&amp;p=2239014</guid>
        <pubDate>Wed, 08 Apr 2009 21:58:56 +0000</pubDate>
        <title>OLE Automation, в Visual C не срабатывает</title>
        <link>https://forum.sources.ru/index.php?showtopic=269168&amp;view=findpost&amp;p=2239014</link>
        <description><![CDATA[v_klad: Попробуй подключиться к серверу, используя директиву #import <a class='tag-url' href='http://www.rsdn.ru/article/vcpp/import.xml' target='_blank'>Посмотри здесь</a>]]></description>
        <author>v_klad</author>
        <category>Visual C++ / MFC / WTL</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=269168&amp;view=findpost&amp;p=2235399</guid>
        <pubDate>Sat, 04 Apr 2009 09:45:33 +0000</pubDate>
        <title>OLE Automation, в Visual C не срабатывает</title>
        <link>https://forum.sources.ru/index.php?showtopic=269168&amp;view=findpost&amp;p=2235399</link>
        <description><![CDATA[shadowbolt: Есть некая ДЛЛ, в которой ОЛЕ сервер некой проги StoreHouse4 - Sh4Ole.dll. Она прописана в реестре, и из 1С нормально вызывается и работает:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">sh=СоздатьОбъект(&quot;Sh4Ole.Sh4App&quot;); //CreateOleObject(&#39;Sh4Ole.Sh4App&#39;) - для бейсика</div><div class="code_line">sh.DBLogin();</div><div class="code_line">sh.DBLogout();</div></ol></div></div></div></div><br>
<br>
Делаю аналог на Visual C:<br>
1. Создаю дефолтный MFC dialog-based проект, на диалоге кнопка с обработкой нажатия.<br>
2. В самое начало InitInstance() добавляю AfxOleInit() с проверкой.<br>
3. ClassWizard-&gt;Automation-&gt;Add Class-&gt;From a type library-&gt;Sh4Ole.dll. Создает класс ISH4Ole, инклудю его в свой CPP.<br>
4.Код на кнопке<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">ISH4Ole sh4; </div><div class="code_line">if (!sh4.CreateDispatch(&quot;Sh4Ole.SH4App&quot;))</div><div class="code_line">&nbsp;&nbsp; &nbsp;{ </div><div class="code_line">&nbsp;&nbsp; AfxMessageBox(&quot;Sh4Ole не найден.&quot;); </div><div class="code_line">&nbsp;&nbsp; return; </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div></ol></div></div></div></div><br>
<br>
Было подозрение, может вызывать не &quot;Sh4Ole.SH4App&quot;, а как-то по другому, но в реестре в CLSID только такой вызов нашел.<br>
<br>
Вобщем &quot;Sh4Ole не найден.&quot; и на выход. Подскажите где я ошибся.]]></description>
        <author>shadowbolt</author>
        <category>Visual C++ / MFC / WTL</category>
      </item>
	
      </channel>
      </rss>
	