<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Форум Guardant &mdash; Помощь c non-Static CallBack]]></title>
		<link>https://forum.guardant.ru/topic/917/</link>
		<atom:link href="https://forum.guardant.ru/feed/rss/topic/917" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Помощь c non-Static CallBack».]]></description>
		<lastBuildDate>Tue, 22 Dec 2020 07:19:01 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Помощь c non-Static CallBack]]></title>
			<link>https://forum.guardant.ru/post/4441/#p4441</link>
			<description><![CDATA[<div class="quotebox"><cite>aurusoft пишет:</cite><blockquote><p>Коллеги, может кому-то пригодится!</p><p>Вопрос решили по нестатической функции класса!</p><p>std::function&lt;void(HANDLE, int)&gt; _callback_prot;<br />extern &quot;C&quot; void _wrapper(HANDLE h, int v)<br />{<br />&nbsp; &nbsp;_callback_prot(h, v);<br />}<br />Class A{<br />&nbsp; &nbsp; // Dongle Notification CallBack routine<br />&nbsp; &nbsp;&nbsp; virtual void OnDongleCallback(&nbsp; &nbsp; HANDLE hGrd,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int nGrdNotifyMessage<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )&nbsp; <br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; return;<br />&nbsp; &nbsp; } <br />&nbsp; &nbsp; bool RegisterCallback(void){<br />&nbsp; &nbsp; &nbsp; &nbsp;_callback_prot = std::bind(&amp;A::OnDongleCallback, this, _1, _2);<br />&nbsp; &nbsp; grdResult = ::GrdRegisterDongleNotification(grdHandle, _wrapper);<br />&nbsp; &nbsp; }<br />};</p><p>Всё работает!</p><p>Предлагаю включить в примеры работы на С++!</p><p>С уважением,<br />aurusoft@mail.ru</p></blockquote></div><p>Благодарим за обратную связь!</p>]]></description>
			<author><![CDATA[null@example.com (Тимофей Ершов)]]></author>
			<pubDate>Tue, 22 Dec 2020 07:19:01 +0000</pubDate>
			<guid>https://forum.guardant.ru/post/4441/#p4441</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помощь c non-Static CallBack]]></title>
			<link>https://forum.guardant.ru/post/4440/#p4440</link>
			<description><![CDATA[<p>Коллеги, может кому-то пригодится!</p><p>Вопрос решили по нестатической функции класса!</p><p>std::function&lt;void(HANDLE, int)&gt; _callback_prot;<br />extern &quot;C&quot; void _wrapper(HANDLE h, int v)<br />{<br />&nbsp; &nbsp;_callback_prot(h, v);<br />}<br />Class A{<br />&nbsp; &nbsp; // Dongle Notification CallBack routine<br />&nbsp; &nbsp;&nbsp; virtual void OnDongleCallback(&nbsp; &nbsp; HANDLE hGrd,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int nGrdNotifyMessage<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )&nbsp; <br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; return;<br />&nbsp; &nbsp; } <br />&nbsp; &nbsp; bool RegisterCallback(void){<br />&nbsp; &nbsp; &nbsp; &nbsp;_callback_prot = std::bind(&amp;A::OnDongleCallback, this, _1, _2);<br />&nbsp; &nbsp; grdResult = ::GrdRegisterDongleNotification(grdHandle, _wrapper);<br />&nbsp; &nbsp; }<br />};</p><p>Всё работает!</p><p>Предлагаю включить в примеры работы на С++!</p><p>С уважением,<br />aurusoft@mail.ru</p>]]></description>
			<author><![CDATA[null@example.com (aurusoft)]]></author>
			<pubDate>Mon, 21 Dec 2020 14:16:52 +0000</pubDate>
			<guid>https://forum.guardant.ru/post/4440/#p4440</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помощь c non-Static CallBack]]></title>
			<link>https://forum.guardant.ru/post/4439/#p4439</link>
			<description><![CDATA[<p>Здравствуйте.</p><p>Спасибо за оперативный ответ!</p><p>Принято!</p><p>С уважением...</p>]]></description>
			<author><![CDATA[null@example.com (aurusoft)]]></author>
			<pubDate>Fri, 18 Dec 2020 12:06:33 +0000</pubDate>
			<guid>https://forum.guardant.ru/post/4439/#p4439</guid>
		</item>
		<item>
			<title><![CDATA[Re: Помощь c non-Static CallBack]]></title>
			<link>https://forum.guardant.ru/post/4438/#p4438</link>
			<description><![CDATA[<p>Добрый день. У нас таких примеров нет (<a href="https://dev.guardant.ru/display/KB/0017">Рекомендации по работе с примерами</a>). Но похожие примеры можно найти в открытых источниках, например, <a href="https://stackoverflow.com/questions/3725425/class-method-as-winapi-callback">здесь</a>.</p>]]></description>
			<author><![CDATA[null@example.com (Тимофей Ершов)]]></author>
			<pubDate>Fri, 18 Dec 2020 11:55:57 +0000</pubDate>
			<guid>https://forum.guardant.ru/post/4438/#p4438</guid>
		</item>
		<item>
			<title><![CDATA[Помощь c non-Static CallBack]]></title>
			<link>https://forum.guardant.ru/post/4437/#p4437</link>
			<description><![CDATA[<p>Здравствуйте.</p><p>Подробно:<br />Используем С++ (Win 10)</p><p>Имеется класс работы с Dongle. После переопределения функции и её описания в классе<br />Class A{<br />&nbsp; &nbsp; typedef void (A::*CallbackFun)(HANDLE, int);<br />&nbsp; &nbsp; void&nbsp; &nbsp;_OnDongleCallback( HANDLE hGrd,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Handle to Guardant protected container<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; int nGrdNotifyMessage<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )&nbsp; // Dongle notification message. See GrdNotifyMessage_XXX definition<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; return;<br />&nbsp; &nbsp; } <br />&nbsp; &nbsp; bool RegisterCallback(){<br />&nbsp; &nbsp; &nbsp; &nbsp;CallbackFun _CallbackFun = &amp;A::_OnDongleCallback;<br />&nbsp; &nbsp; &nbsp; &nbsp; //_grdHandle - ключ корректный <br />&nbsp; &nbsp; &nbsp; &nbsp;_grdResult = ::GrdRegisterDongleNotification(_grdHandle, reinterpret_cast&lt;GrdDongleNotifyCallBack*&gt;(&amp;_CallbackFun) );<br />&nbsp; &nbsp; &nbsp; &nbsp; //_grdResult - Ошибок нет<br />&nbsp; &nbsp; }<br />}</p><p>Код отрабатывается хорошо. Но при изъятии ключа - происходит Exception!</p><p>Есть ли пример использования не СТАТИЧНОЙ CallBack функции класса при регистрации в GrdRegisterDongleNotification(...)?</p><p>Заранее благодарен...</p>]]></description>
			<author><![CDATA[null@example.com (aurusoft)]]></author>
			<pubDate>Thu, 17 Dec 2020 17:09:29 +0000</pubDate>
			<guid>https://forum.guardant.ru/post/4437/#p4437</guid>
		</item>
	</channel>
</rss>
