<?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=416823&amp;view=findpost&amp;p=3821136</guid>
        <pubDate>Sat, 15 Feb 2020 08:40:30 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3821136</link>
        <description><![CDATA[JoeUser: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3821132'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Wound &#064; <time class="tag-quote__quoted-time" datetime="2020-02-15T11:21:36+03:00">15.02.20, 08:21</time></span><div class='quote '> я туда вставлял отжатие кнопки через 50 мс</div></div><br>
Это ты работал на пределе, ИМХО. К примеру, есть клавы с реакцией 60мс (универсальный интерфейс от Logitech). Я бы смело ставил 75 мс и не парился. Хотя нет - парился бы на тестах. Открыл бы блокнот и гонял бы прогу на ввод 1-2 символов на разных скоростях. Ну и нашел бы предел, когда интерфейс клавиатуры переставал бы тащить.]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3821132</guid>
        <pubDate>Sat, 15 Feb 2020 08:21:36 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3821132</link>
        <description><![CDATA[Wound: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3821131'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>JoeUser &#064; <time class="tag-quote__quoted-time" datetime="2020-02-15T08:11:35+00:00">15.02.20, 08:11</time></span><div class='quote '>Ты что&#33;&#33;&#33; :blink: Это не можно - это обязательно&#33;&#33;&#33; Иначе комп просто сума сойдет. Представь как должна будет реагировать система, к примеру, на нажатие уже нажатой клавиши. Я в программном варианте. И если ты отжатия клавиш не передавал - считай это и был твой источник глюков. Это даже важнее того, что я предположил сразу. Если найдешь свою старую тему, можем еще раз её глянуть.</div></div><br>
Ну там я воспроизводил цепочку нажатий и очень быстро, я туда вставлял отжатие кнопки через 50 мс. Но возможно у меня слишком быстро и часто нажатия были и очень много, из за чего переполнялся буфер. Там пол часа программа тыкала по 3-5 раз в секунду, и со временем иногда бывали вот такие глюки, даже когда посылка сообщений прекращалась, еще какое то время нажимались клавиши ЕМНИП :D <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-15T08:21:53+00:00">15.02.20, 08:21</time></span></span><br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3821131'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>JoeUser &#064; <time class="tag-quote__quoted-time" datetime="2020-02-15T08:11:35+00:00">15.02.20, 08:11</time></span><div class='quote '>Вощем, Киля, тебе еще раз спасибо - выручил&#33;</div></div><br>
Пожалуйста&#33;]]></description>
        <author>Wound</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3821131</guid>
        <pubDate>Sat, 15 Feb 2020 08:11:35 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3821131</link>
        <description><![CDATA[JoeUser: <strong class='tag-b'>Wound</strong>, конечно же я еще все потестирую и не раз.<br>
<br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3821128'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Wound &#064; <time class="tag-quote__quoted-time" datetime="2020-02-15T06:55:40+00:00">15.02.20, 06:55</time></span><div class='quote '>Так вот, я не знаю как у тебя, у меня наблюдались небольшие глюки с вызовом этой функции.</div></div><br>
И я даже предполагаю почему у тебя было. В моем случае (скорее всего) глюков не будет, потому как я работаю на скорости реакции картридера (сперва читаю, потом пишу и это на его скорости). А это примерно на 50мс между нажатиями/отжатиями. И мне не приходилось добавлять нажатия, а только фильтровать, сиречь - удалять. В твоем же случае, на сколько я помню, ты внедрял свою цепочку нажатий. Поэтом самым первым методом я бы смоделировал задержку перед вводом самого текста (цепочки нажатий) примерно в 75-100мс, а между нажатиями и отжатиями - не менее 50 мс.<br>
<br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3821128'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Wound &#064; <time class="tag-quote__quoted-time" datetime="2020-02-15T06:55:40+00:00">15.02.20, 06:55</time></span><div class='quote '>Либо же возможно еще можно послать код отпускания клавиши(после ее нажатия через скажем 20-50 мс)</div></div><br>
Ты что&#33;&#33;&#33;  :blink: Это не можно - это обязательно&#33;&#33;&#33; Иначе комп просто сума сойдет. Представь как должна будет реагировать система, к примеру, на нажатие уже нажатой клавиши. Я в программном варианте. И если ты отжатия клавиш не передавал - считай это и был твой источник глюков. Это даже важнее того, что я предположил сразу. Если найдешь свою старую тему, можем еще раз её глянуть.<br>
<br>
Вощем, <strong class='tag-b'>Киля</strong>, тебе еще раз спасибо - выручил&#33;<br>
<br>
З.Ы: Если и дойдут руки писать дрова, так это точно не сегодня  :)]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3821128</guid>
        <pubDate>Sat, 15 Feb 2020 06:55:40 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3821128</link>
        <description><![CDATA[Wound: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3821119'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>JoeUser &#064; <time class="tag-quote__quoted-time" datetime="2020-02-15T02:27:49+00:00">15.02.20, 02:27</time></span><div class='quote '>Таким образом &quot;рыба&quot; считывателя с использованием обсуждаемой либы такая (параллелизм считывания вне этой темы):</div></div><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">interception_send(context, device, &amp;stroke, 1);</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><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">MSG msg;</div><div class="code_line">PeekMessage(&amp;msg, 0, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE);</div></ol></div></div></div></div><br>
Вроде как помогало. Но были какие то ньюансы. В общем я бы на твоем месте тщательно все протестировал.<br>
Либо же возможно еще можно послать код отпускания клавиши(после ее нажатия через скажем 20-50 мс), но я не помню лечится это так или нет. Давно я с этим работал, такие детали уже не помню. :-?]]></description>
        <author>Wound</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3821123</guid>
        <pubDate>Sat, 15 Feb 2020 03:02:30 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3821123</link>
        <description><![CDATA[JoeUser: ADD: А эта регулярка для разбора данных карточки (для Люфтганзы, другие не смотрел):<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">^%.*?\^(.+)\^.+;(\d{4})(\d{4})(\d{4})(\d{3})=(\d{2})(\d{2}).*$</div></ol></div></div></div></div><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">Group 1. DR. ULADZIMIR NOVIK &nbsp; &nbsp; &nbsp; </div><div class="code_line">Group 2. 9922</div><div class="code_line">Group 3. 2508</div><div class="code_line">Group 4. 9113</div><div class="code_line">Group 5. 628</div><div class="code_line">Group 6. 17</div><div class="code_line">Group 7. 02</div></ol></div></div></div></div>]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3821119</guid>
        <pubDate>Sat, 15 Feb 2020 02:27:49 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3821119</link>
        <description><![CDATA[JoeUser: В общем, библиотека знатно помогла решить вопрос. Конечно, специализация ее узкая, и не следует от нее требовать чего-то большего. Остальное попробую получить другими средствами (мониторинг включения-отключения USB-картридера, к примеру). Вот тут я думаю libusb и поможет. Если это не де жа вю, вроде бы я там видел регистрации функций обратного вызова на включение-отключение устройств.<br>
<br>
Ну а пока ... магнитные карточки читаются (на изображении сырые строки с карточек Люфтганзы):<br>
<br>
<img class='tag-img' src='https://i111.fastpic.ru/big/2020/0215/66/5d8385f61f8eeafd96a2a1e6bb9cec66.png' alt='user posted image'><br>
<br>
Дальнейший парсинг будет несложен, методы кодирования описаны в <a class='tag-url' href='http://docs.cntd.ru/document/1200082257' target='_blank'>ISO-7811</a>. Хотя, как я понял, закодированную информацию (мой) картридер преобразует в сканкоды клавиатуры. Разделения полей данных на карте опять же по выше указанному ISO<br>
<div class="tag-spoiler spoiler closed"><div class="spoiler_header" onclick="openCloseParent(this)">Скрытый текст</div><div class="body"><br>
14 следующих символов &#33; &quot; &amp; &#39; * + , : ;&lt; = &gt; @ _ применяют только для управления аппаратными средствами. Данные символы не могут быть использованы для передачи информации (содержания данных).<br>
<br>
Три следующих символа [&#092;] зарезервированы для дополнительных национальных символов, если они потребуются. Данные символы не допускается использовать на международном уровне.<br>
<br>
Символ # зарезервирован для произвольных дополнительных графических символов.<br>
<br>
Три следующих символа % ^ ? должны иметь следующие значения:<br>
<br>
% - сигнальная метка начала;<br>
<br>
^ - разделитель полей;<br>
<br>
? - сигнальная метка конца.<br>
</div></div><br>
Таким образом &quot;рыба&quot; считывателя с использованием обсуждаемой либы такая (параллелизм считывания вне этой темы):<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">void Widget_Main::SlotRun() {</div><div class="code_line">&nbsp;&nbsp;std::vector &#60;std::pair&#60;uint8_t, uint8_t&#62;&#62; V;</div><div class="code_line">&nbsp;&nbsp;InterceptionContext context;</div><div class="code_line">&nbsp;&nbsp;InterceptionDevice device;</div><div class="code_line">&nbsp;&nbsp;InterceptionStroke stroke;</div><div class="code_line">&nbsp;&nbsp;wchar_t hardware_id[500];</div><div class="code_line">&nbsp;&nbsp;auto last = std::chrono::high_resolution_clock::now();</div><div class="code_line">&nbsp;&nbsp;context = interception_create_context();</div><div class="code_line">&nbsp;&nbsp;interception_set_filter(context, interception_is_keyboard, INTERCEPTION_FILTER_KEY_ALL);</div><div class="code_line">&nbsp;&nbsp;while (true) {</div><div class="code_line">&nbsp;&nbsp; &nbsp;while (true) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;device = interception_wait_with_timeout(context, 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if (!device) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;QCoreApplication::processEvents();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;auto now = std::chrono::high_resolution_clock::now();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (std::chrono::duration_cast&#60;std::chrono::milliseconds&#62;(now - last).count() &#62; 100 &amp;&amp; &nbsp;V.size() &#62; 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;T-&#62;append(QString::fromStdString(KeycodeParser(V)));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;V.clear();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;last = now;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;} else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;break;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;if (interception_receive(context, device, &amp;stroke, 1) &#62; 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if (interception_is_keyboard(device)) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;InterceptionKeyStroke&amp; keystroke = *(InterceptionKeyStroke*) &stroke;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (keystroke.code == ScanCode::SCANCODE_ESC)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;size_t length = interception_get_hardware_id(context, device, hardware_id, sizeof(hardware_id));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (length &#62; 0 &amp;&amp; length &#60; sizeof(hardware_id)) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;QString Str = QString::fromWCharArray(hardware_id);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (Str == &quot;HID\VID_0801&amp;PID_0001&amp;REV_0100&quot;) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;V.push_back(std::pair(keystroke.code, keystroke.state));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;last = std::chrono::high_resolution_clock::now();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;interception_send(context, device, &amp;stroke, 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;qDebug() &#60;&#60; &quot;Хрень какая-то 0_o!&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp;}</div><div class="code_line">&nbsp;&nbsp;interception_destroy_context(context);</div><div class="code_line">&nbsp;&nbsp;T-&#62;append(&quot;&quot;);</div><div class="code_line">&nbsp;&nbsp;T-&#62;append(&quot;Bye!&quot;);</div><div class="code_line">}</div></ol></div></div></div></div><br>
Преобразование скан-кодов в символьную последовательность:<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">typedef std::map&#60;uint8_t, std::pair&#60;uint8_t, uint8_t&#62;&#62; ScanMap;</div><div class="code_line">&nbsp;</div><div class="code_line">const ScanMap MapChars = {</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x02, {&#39;1&#39;, &#39;!&#39;}}, {0x03, {&#39;2&#39;, &#39;@&#39;}}, {0x04, {&#39;3&#39;, &#39;#&#39;}}, {0x05, {&#39;4&#39;, &#39;$&#39;}}, {0x06, {&#39;5&#39;, &#39;%&#39;}},</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x07, {&#39;6&#39;, &#39;^&#39;}}, {0x08, {&#39;7&#39;, &#39;&amp;&#39;}}, {0x09, {&#39;8&#39;, &#39;*&#39;}}, {0x0a, {&#39;9&#39;, &#39;(&#39;}}, {0x0b, {&#39;0&#39;, &#39;)&#39;}},</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x0c, {&#39;-&#39;, &#39;_&#39;}}, {0x0d, {&#39;=&#39;, &#39;+&#39;}}, {0x10, {&#39;q&#39;, &#39;Q&#39;}}, {0x11, {&#39;w&#39;, &#39;W&#39;}}, {0x12, {&#39;e&#39;, &#39;E&#39;}},</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x13, {&#39;r&#39;, &#39;R&#39;}}, {0x14, {&#39;t&#39;, &#39;T&#39;}}, {0x15, {&#39;y&#39;, &#39;Y&#39;}}, {0x16, {&#39;u&#39;, &#39;U&#39;}}, {0x17, {&#39;i&#39;, &#39;I&#39;}},</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x18, {&#39;o&#39;, &#39;O&#39;}}, {0x19, {&#39;p&#39;, &#39;P&#39;}}, {0x1a, {&#39;[&#39;, &#39;{&#39;}}, {0x1b, {&#39;]&#39;, &#39;}&#39;}}, {0x1e, {&#39;a&#39;, &#39;A&#39;}},</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x1f, {&#39;s&#39;, &#39;S&#39;}}, {0x20, {&#39;d&#39;, &#39;D&#39;}}, {0x21, {&#39;f&#39;, &#39;F&#39;}}, {0x22, {&#39;g&#39;, &#39;G&#39;}}, {0x23, {&#39;h&#39;, &#39;H&#39;}},</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x24, {&#39;j&#39;, &#39;J&#39;}}, {0x25, {&#39;k&#39;, &#39;K&#39;}}, {0x26, {&#39;l&#39;, &#39;L&#39;}}, {0x27, {&#39;;&#39;, &#39;:&#39;}}, {0x28, {&#39;\&#39;&#39;, &#39;&quot;&#39;}},</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x29, {&#39;`&#39;, &#39;~&#39;}}, {0x2b, {&#39;\&#39;, &#39;|&#39;}}, {0x2c, {&#39;z&#39;, &#39;Z&#39;}}, {0x2d, {&#39;x&#39;, &#39;X&#39;}}, {0x2e, {&#39;c&#39;, &#39;C&#39;}},</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x2f, {&#39;v&#39;, &#39;V&#39;}}, {0x30, {&#39;b&#39;, &#39;B&#39;}}, {0x31, {&#39;n&#39;, &#39;N&#39;}}, {0x32, {&#39;m&#39;, &#39;M&#39;}}, {0x33, {&#39;,&#39;, &#39;&#60;&#39;}},</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x34, {&#39;.&#39;, &#39;&#62;&#39;}}, {0x35, {&#39;/&#39;, &#39;?&#39;}}, {0x37, {&#39;*&#39;, &#39;*&#39;}}, {0x39, {&#39; &#39;, &#39; &#39;}}, {0x47, {&#39;7&#39;, &#39;7&#39;}},</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x48, {&#39;8&#39;, &#39;8&#39;}}, {0x49, {&#39;9&#39;, &#39;9&#39;}}, {0x4a, {&#39;-&#39;, &#39;-&#39;}}, {0x4b, {&#39;4&#39;, &#39;4&#39;}}, {0x4c, {&#39;5&#39;, &#39;5&#39;}},</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x4d, {&#39;6&#39;, &#39;6&#39;}}, {0x4e, {&#39;+&#39;, &#39;+&#39;}}, {0x4f, {&#39;1&#39;, &#39;1&#39;}}, {0x50, {&#39;2&#39;, &#39;2&#39;}}, {0x51, {&#39;3&#39;, &#39;3&#39;}},</div><div class="code_line">&nbsp;&nbsp; &nbsp;{0x52, {&#39;0&#39;, &#39;0&#39;}}, {0x53, {&#39;.&#39;, &#39;.&#39;}}</div><div class="code_line">};</div><div class="code_line">&nbsp;</div><div class="code_line">// .....</div><div class="code_line">&nbsp;</div><div class="code_line">std::string KeycodeParser(std::vector&#60;std::pair&#60;uint8_t, uint8_t&#62;&#62;&amp; V) {</div><div class="code_line">&nbsp;&nbsp; &nbsp;std::string Ret = &quot;&quot;;</div><div class="code_line">&nbsp;&nbsp; &nbsp;bool Shift = false;</div><div class="code_line">&nbsp;&nbsp; &nbsp;for (auto&amp;&amp; i : V) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (i.first == 0x2a || i.first == 0x36) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Shift = (i.second == 0x00);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;continue;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;try {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (i.second == 0x00) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;std::pair&#60;uint8_t, uint8_t&#62; S = MapChars.at(i.first);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Ret += (Shift) ? S.second : S.first;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (std::out_of_range&amp;) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;QMessageBox::warning(qApp-&#62;activeWindow(), QString(&quot;Внимание&quot;), QString(&quot;Ключ таблицы сканкодов не найден: &quot;) + QString(std::get&#60;0&#62;(i)));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;} catch (...) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;QMessageBox::warning(qApp-&#62;activeWindow(), QString(&quot;Внимание&quot;), QString(&quot;Случилось что-то страшное!&quot;));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;return Ret;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
Надеюсь может быть кому-нить когда-нить поможет&#33;  :) <br>
Засим вопрос считаю пока закрытым.]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820968</guid>
        <pubDate>Wed, 12 Feb 2020 14:29:41 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820968</link>
        <description><![CDATA[JoeUser: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820967'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Qraizer &#064; <time class="tag-quote__quoted-time" datetime="2020-02-12T14:26:22+00:00">12.02.20, 14:26</time></span><div class='quote '>Хуже TerminateThread() только NtShutdownSystem() </div></div><br>
 :good:  :jokingly:]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820967</guid>
        <pubDate>Wed, 12 Feb 2020 14:26:22 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820967</link>
        <description><![CDATA[Qraizer: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820962'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>JoeUser &#064; <time class="tag-quote__quoted-time" datetime="2020-02-12T13:27:49+00:00">12.02.20, 13:27</time></span><div class='quote '>Т.к. очень не хочется использовать TerminateThread, это не по фэншую С++</div></div>Это не по фэншую WinAPI. Хуже TerminateThread() только NtShutdownSystem()]]></description>
        <author>Qraizer</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820964</guid>
        <pubDate>Wed, 12 Feb 2020 13:51:24 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820964</link>
        <description><![CDATA[JoeUser: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820963'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Wound &#064; <time class="tag-quote__quoted-time" datetime="2020-02-12T13:37:40+00:00">12.02.20, 13:37</time></span><div class='quote '>Странно что сообщение два раза вставилось</div></div><br>
Наверное это из-за того, что я первое свое сообщение в треде закрепил.<br>
А иначе оно по дате (после переноса сообщений) просто бы потонуло.]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820963</guid>
        <pubDate>Wed, 12 Feb 2020 13:37:40 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820963</link>
        <description><![CDATA[Wound: Ну норм, теперь обвязку сделать осталось над библиотекой мультипоточную и норм будет. <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-12T13:38:30+00:00">12.02.20, 13:38</time></span></span><br>
Странно что сообщение два раза вставилось.  :blink: <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-12T13:39:04+00:00">12.02.20, 13:39</time></span></span><br>
Седня 1 апреля что ли? :scratch:  На двух страницах одно и то же сообщение 2 раза  :-?]]></description>
        <author>Wound</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820962</guid>
        <pubDate>Wed, 12 Feb 2020 13:27:49 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820962</link>
        <description><![CDATA[JoeUser: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820957'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Wound &#064; <time class="tag-quote__quoted-time" datetime="2020-02-12T12:59:31+00:00">12.02.20, 12:59</time></span><div class='quote '>Ну и чего? Заработало оно у тебя? </div></div><br>
Ну да, перехватывать ввод с карт-ридера и не отдавать его в систему - получилось&#33;<br>
<br>
Сейчас вот колдую над кодом, чтобы использовать <strong class='tag-b'>interception_wait_with_timeout</strong>, потому как в недрах библиотеки эта кухня завязана на <strong class='tag-b'>WaitForMultipleObjects</strong>, а с параметром INFINITE меня не устраивает. Т.к. очень не хочется использовать TerminateThread, это не по фэншую С++]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820957</guid>
        <pubDate>Wed, 12 Feb 2020 12:59:31 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820957</link>
        <description><![CDATA[Wound: Ну и чего? Заработало оно у тебя? :huh:]]></description>
        <author>Wound</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820953</guid>
        <pubDate>Wed, 12 Feb 2020 11:41:39 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820953</link>
        <description><![CDATA[JoeUser: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820940'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Wound &#064; <time class="tag-quote__quoted-time" datetime="2020-02-12T08:06:35+00:00">12.02.20, 08:06</time></span><div class='quote '>Так а что там кстати, получилось не пускать прочитанное дальше?</div></div><br>
В общем - облом&#33; Смотри кусок кода:<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">void Widget_Main::SlotRun() {</div><div class="code_line">&nbsp;&nbsp; &nbsp;InterceptionContext context;</div><div class="code_line">&nbsp;&nbsp; &nbsp;InterceptionDevice device;</div><div class="code_line">&nbsp;&nbsp; &nbsp;InterceptionStroke stroke;</div><div class="code_line">&nbsp;&nbsp; &nbsp;wchar_t hardware_id[500];</div><div class="code_line">&nbsp;&nbsp; &nbsp;context = interception_create_context();</div><div class="code_line">&nbsp;&nbsp; &nbsp;interception_set_filter(context, interception_is_keyboard, INTERCEPTION_FILTER_KEY_DOWN | INTERCEPTION_FILTER_KEY_UP);</div><div class="code_line">&nbsp;&nbsp; &nbsp;while (interception_receive(context, device = interception_wait(context), &amp;stroke, 1) &#62; 0) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (interception_is_keyboard(device)) {</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;InterceptionKeyStroke&amp; keystroke = *(InterceptionKeyStroke*) &stroke;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (keystroke.code == SCANCODE_ESC)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;break;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;size_t length = interception_get_hardware_id(context, device, hardware_id, sizeof(hardware_id));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (length &#62; 0 &amp;&amp; length &#60; sizeof(hardware_id))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;std::wcout &#60;&#60; hardware_id &#60;&#60; std::endl;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;// interception_send(context, device, &amp;stroke, 1); &nbsp;&#60;&#60; ---------------------- видишь закомментил!</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;interception_destroy_context(context);</div><div class="code_line">&nbsp;&nbsp; &nbsp;T-&#62;append(&quot;Ups!&quot;);</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
И вот какая наблюдается ситуация:<br>
<br>
1) Запускаю прогу, жму кнопку начала опроса карт-ридера<br>
2) Переключаюсь на редактор фара<br>
3) Провожу карточкой по карт-ридеру<br>
4) Весь вывод из карточки гасится ... но в редакторе вставляется перевод строки :(<br>
<br>
Откуда этот перевод строки берется, если я весь вывод погасил - не знаю.<br>
Таким образом, фильтр &quot;пропускает&quot;. Единственное, что еще не полностью убило<br>
надежду, так это - посмотрю флаги установки фильтра. <br>
<br>
Пока они &quot;INTERCEPTION_FILTER_KEY_DOWN | INTERCEPTION_FILTER_KEY_UP&quot;<br>
Полез в исходники либы. <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-12T11:44:29+00:00">12.02.20, 11:44</time></span></span><br>
INTERCEPTION_FILTER_KEY_ALL  :victory:<br>
<br>
<strong class='tag-b'>Уффф .... <span class="tag-color tag-color-named" data-value="red" style="color: red">можно пробовать кодить дальше&#33;</span></strong>]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820947</guid>
        <pubDate>Wed, 12 Feb 2020 08:54:36 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820947</link>
        <description><![CDATA[JoeUser: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820940'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Wound &#064; <time class="tag-quote__quoted-time" datetime="2020-02-12T08:06:35+00:00">12.02.20, 08:06</time></span><div class='quote '>Так а что там кстати, получилось не пускать прочитанное дальше?</div></div><br>
Еще в процессе, через часок засяду эксперементировать.]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820940</guid>
        <pubDate>Wed, 12 Feb 2020 08:06:35 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820940</link>
        <description><![CDATA[Wound: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820938'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>JoeUser &#064; <time class="tag-quote__quoted-time" datetime="2020-02-12T07:31:58+00:00">12.02.20, 07:31</time></span><div class='quote '>1) Где можно найти соответствие скан-кодам клавиатуры и печатаемым символам?</div></div><br>
На википедии например: <a class='tag-url' href='https://ru.wikipedia.org/wiki/%D0%A1%D0%BA%D0%B0%D0%BD-%D0%BA%D0%BE%D0%B4' target='_blank'>https://ru.wikipedia.org/wiki/%D0%A1%D0%BA%...%BA%D0%BE%D0%B4</a><br>
<br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820938'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>JoeUser &#064; <time class="tag-quote__quoted-time" datetime="2020-02-12T07:31:58+00:00">12.02.20, 07:31</time></span><div class='quote '>2) Цикл опроса клавиатуры я хочу вынести в отдельную нить, какие средства синхронизации посоветуете (желательно языковые С++)?</div></div><br>
Мьютекс бери например :-? <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-12T08:30:30+00:00">12.02.20, 08:30</time></span></span><br>
Так а что там кстати, получилось не пускать прочитанное дальше? <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-12T08:32:19+00:00">12.02.20, 08:32</time></span></span><br>
Про отличие мьютексов от других средств синхронизации: <a class='tag-url' href='https://forum.sources.ru/index.php?showtopic=413311' target='_blank'>Мьютексы С++11, С++14, С++17</a>]]></description>
        <author>Wound</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820938</guid>
        <pubDate>Wed, 12 Feb 2020 07:31:58 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820938</link>
        <description><![CDATA[JoeUser: По ходу возникло два вопроса:<br><br>1) Где можно найти соответствие скан-кодам клавиатуры и печатаемым символам?<br>2) Цикл опроса клавиатуры я хочу вынести в отдельную нить, какие средства синхронизации посоветуете (желательно языковые С++)?]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820935</guid>
        <pubDate>Wed, 12 Feb 2020 06:59:50 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820935</link>
        <description><![CDATA[JoeUser: Всем привет&#33;<br>
<br>
Создал тему с целью разделения <a class='tag-url' href='https://forum.sources.ru/index.php?showtopic=416775' target='_blank'>темы о разработке драйверов под Windows</a>.<br>
Просто чтобы не было обсуждений в одной теме &quot;все-обо-всем&quot;.<br>
<br>
Библиотека <strong class='tag-b'>Interception</strong> реализует перехват и фильтрацию данных от клавиатуры или мыши<br>
не уровне системы с помощью собственного драйвера-фильтра. В обсуждении решается вопрос<br>
перехвата данных от КартРидера, который опознается в системе как HID Keyboard.]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820919</guid>
        <pubDate>Tue, 11 Feb 2020 20:30:30 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820919</link>
        <description><![CDATA[JoeUser: Не не не, смотри:<br>
<img class='tag-img' src='https://i111.fastpic.ru/big/2020/0211/58/52b3b06fe716c63b8fdfd64104db9358.png' alt='user posted image'><br>
В позиции [1] мы читаем и по любому в позиции [2] пишем прочитанное.<br>
Сення уже не буду, завтра сделаю так: если прочитанное с моего картридера (по Id) -<br>
пишу в свою прогу и все, а если не с моего девайса - вызываю [2]. По идее должно<br>
так заработать.<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;<a class='tag-url' href='https://forum.sources.ru/index.php?showtopic=416775' target='_blank'>Программирование драйверов Windows</a>&quot;</span></span>]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820918</guid>
        <pubDate>Tue, 11 Feb 2020 20:19:23 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820918</link>
        <description><![CDATA[Wound: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820916'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>JoeUser &#064; <time class="tag-quote__quoted-time" datetime="2020-02-11T19:57:21+00:00">11.02.20, 19:57</time></span><div class='quote '>Wound, в общем, затестил я предложенную тобою либу - не подходит, увы. Нет, картридер ловит и читает, выводит его ID в виде &quot;HID&#092;VID_0801&amp;PID_0001&amp;REV_0100&quot;. Тобишь читать keystroke из нужного девайса я могу. Но я немогу прочитанное не пускать дальше<br>
в систему. Иными словами, запускаю свою прогу, запускаю цикл чтения, переключаюсь на блокнот, и провожу карточку ... и моя прога<br>
ловит ввод, и в блокноте вываливается содержимое прочитанного. А по API библиотеки ничего не нахожу, чтобы не пустить &quot;нажатие </div></div><br>
Попробуй на обычной клавиатуре. <br>
По идее, вот этот код из примера, первый по этой ссылке: <a class='tag-url' href='http://www.oblita.com/interception.html' target='_blank'>http://www.oblita.com/interception.html</a><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">#include &#60;interception.h&#62;</div><div class="code_line">#include &quot;utils.h&quot;</div><div class="code_line">&nbsp;</div><div class="code_line">enum ScanCode</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;SCANCODE_X &nbsp; = 0x2D,</div><div class="code_line">&nbsp;&nbsp; &nbsp;SCANCODE_Y &nbsp; = 0x15,</div><div class="code_line">&nbsp;&nbsp; &nbsp;SCANCODE_ESC = 0x01</div><div class="code_line">};</div><div class="code_line">&nbsp;</div><div class="code_line">int main()</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;InterceptionContext context;</div><div class="code_line">&nbsp;&nbsp; &nbsp;InterceptionDevice device;</div><div class="code_line">&nbsp;&nbsp; &nbsp;InterceptionKeyStroke stroke;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;raise_process_priority();</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;context = interception_create_context();</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;interception_set_filter(context, interception_is_keyboard, INTERCEPTION_FILTER_KEY_DOWN | INTERCEPTION_FILTER_KEY_UP);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;while(interception_receive(context, device = interception_wait(context), (InterceptionStroke *)&amp;stroke, 1) &#62; 0)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(stroke.code == SCANCODE_X) stroke.code = SCANCODE_Y;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;interception_send(context, device, (InterceptionStroke *)&amp;stroke, 1);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(stroke.code == SCANCODE_ESC) break;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;interception_destroy_context(context);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return 0;</div><div class="code_line">}</div></ol></div></div></div></div><br>
Должен перехватывать все нажатия кнопок на клавиатуре и все отпускания. Затем если ты нажимаешь кнопку Х, он должен подменить ее на Y, если нажимаешь ESC - выход из проги, все остальные кнопки - вроде должен пропускать. Еще посмотри бота для рыбалки, которого я постил там в теме, там в нем автоматом клавиши нажимаются, при этом вроде сам не можешь нажать, кроме определенных клавишь. Т.е. кроме определеных он блокирует остальные. <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-11T20:22:01+00:00">11.02.20, 20:22</time></span></span><br>
Вот эта фигня: interception_set_filter(context, interception_is_keyboard, INTERCEPTION_FILTER_KEY_DOWN | INTERCEPTION_FILTER_KEY_UP); - ставит фильтр на отслеживание нажатых клавишь.<br>
while(interception_receive(context, device = interception_wait(context), (InterceptionStroke *)&amp;stroke, 1) &gt; 0)- эта фигня по идее перехватывать нажатия/отпускания, заданные в фильтре.<br>
interception_send(context, device, (InterceptionStroke *)&amp;stroke, 1); - вот эта фигня - эмулирует нажатие клавишь. <br>
Вроде бы так, но я точно не помню. Просто ты можешь перехватить клавишу, и как то ее выкинуть из буфера ввода/вывода. <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-11T20:25:08+00:00">11.02.20, 20:25</time></span></span><br>
По идее тебе нужно поставить фильтр, и ловить клавиши. Дальше - ты можешь их например посылать только определенной проге. Например там через SendMessage, или что то подобное. Хендл нужного окна можно вытащить из процесса.<br>
Это если тебе нужно посылать именно туда куда нужно. <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-11T20:26:05+00:00">11.02.20, 20:26</time></span></span><br>
В общем попробуй сначало поиграть с клавиатурой, только сделай кнопку выхода обязательно, а то можешь вот так зависнуть. Или перехватывай только клаву, мышь не трогай. Чтоб закрыть прогу. Если с клавиатурой получится все(а там по идее должно получится), тогда уже пробуй с кардридером баловаться.<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;<a class='tag-url' href='https://forum.sources.ru/index.php?showtopic=416775' target='_blank'>Программирование драйверов Windows</a>&quot;</span></span>]]></description>
        <author>Wound</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820916</guid>
        <pubDate>Tue, 11 Feb 2020 19:57:21 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820916</link>
        <description><![CDATA[JoeUser: <strong class='tag-b'>Wound</strong>, в общем, затестил я предложенную тобою либу - не подходит, увы. Нет, картридер ловит и читает, выводит его ID в виде &quot;HID&#092;VID_0801&amp;PID_0001&amp;REV_0100&quot;. Тобишь читать keystroke из нужного девайса я могу. Но я немогу прочитанное не пускать дальше<br>
в систему. Иными словами, запускаю свою прогу, запускаю цикл чтения, переключаюсь на блокнот, и провожу карточку ... и моя прога <br>
ловит ввод, и в блокноте вываливается содержимое прочитанного. А по API библиотеки ничего не нахожу, чтобы не пустить &quot;нажатие <br>
клавиши&quot; дальше  :-? <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-11T20:09:19+00:00">11.02.20, 20:09</time></span></span><br>
ADD: Хотя погоди ... там в коде есть вызов &quot;interception_send(context, device, &amp;stroke, 1);&quot;, возможно он далее &quot;проталкивает&quot; считанное :-? Ща еще поэксперементирую.<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;<a class='tag-url' href='https://forum.sources.ru/index.php?showtopic=416775' target='_blank'>Программирование драйверов Windows</a>&quot;</span></span>]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820582</guid>
        <pubDate>Fri, 07 Feb 2020 08:26:09 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820582</link>
        <description><![CDATA[Wound: Вот примеры: <a class='tag-url' href='https://github.com/oblitum/Interception' target='_blank'>https://github.com/oblitum/Interception</a> <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-07T08:27:48+00:00">07.02.20, 08:27</time></span></span><br>
Там вроде просто по порядковому номеру передавать нужно, я не помню точно. Я года два назад с этим работал. Но там точно можно захватывать выборочно устройства по IDшнику. Просто нужно почитать доку, посмотреть примеры. Установить драйвер у себя, взять либу, написать тестовый пример, который например работает с 1 кнопкой. И поиграться. И сразу станет понятно как там что и зачем и куда передается. <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-07T08:30:51+00:00">07.02.20, 08:30</time></span></span><br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820581'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>JoeUser &#064; <time class="tag-quote__quoted-time" datetime="2020-02-07T08:25:11+00:00">07.02.20, 08:25</time></span><div class='quote '>Хм ... интересно. Щяс заценим&#33; </div></div><br>
Только на этот раз установи библиотеку и скомпилируй пример, проверь руками. А то ты уже 3 тему с этой USB клавиатурой создаешь. Поверь - быстрее, проверить вот это, чем писать свой драйвер, особенно если опыта в драйверописании у тебя 0. <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-07T08:50:28+00:00">07.02.20, 08:50</time></span></span><br>
Я вот щас исходник глянул этой библиотеки, она по умолчанию захватывает все устройства(клавиатура или мышь), а дальше, через InterceptionDevice - ты ей указываешь какое именно устройство ей нужно обрабатывать. Посмотри исходники: <a class='tag-url' href='https://github.com/oblitum/Interception/blob/master/library/interception.c' target='_blank'>https://github.com/oblitum/Interception/blo.../interception.c</a><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">int interception_send(InterceptionContext context, InterceptionDevice device, const InterceptionStroke *stroke, unsigned int nstroke)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;InterceptionDeviceArray device_array = (InterceptionDeviceArray)context;</div><div class="code_line">&nbsp;&nbsp; &nbsp;DWORD strokeswritten = 0;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if(context == 0 || nstroke == 0 || interception_is_invalid(device) || !device_array[device - 1].handle) return 0;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if(interception_is_keyboard(device))</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;PKEYBOARD_INPUT_DATA rawstrokes = (PKEYBOARD_INPUT_DATA)HeapAlloc(GetProcessHeap(), 0, nstroke * sizeof(KEYBOARD_INPUT_DATA));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;unsigned int i;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(!rawstrokes) return 0;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for(i = 0; i &#60; nstroke; ++i)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;InterceptionKeyStroke *key_stroke = (InterceptionKeyStroke *) stroke;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].UnitId = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].MakeCode = key_stroke[i].code;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].Flags = key_stroke[i].state;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].Reserved = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].ExtraInformation = key_stroke[i].information;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;DeviceIoControl(device_array[device - 1].handle, IOCTL_WRITE, rawstrokes,(DWORD)nstroke * sizeof(KEYBOARD_INPUT_DATA), NULL, 0, &amp;strokeswritten, NULL);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;HeapFree(GetProcessHeap(), 0, &nbsp;rawstrokes);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;strokeswritten /= sizeof(KEYBOARD_INPUT_DATA);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;PMOUSE_INPUT_DATA rawstrokes = (PMOUSE_INPUT_DATA)HeapAlloc(GetProcessHeap(), 0, nstroke * sizeof(MOUSE_INPUT_DATA));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;unsigned int i;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(!rawstrokes) return 0;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for(i = 0; i &#60; nstroke; ++i)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;InterceptionMouseStroke *mouse_stroke = (InterceptionMouseStroke *) stroke;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].UnitId = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].Flags = mouse_stroke[i].flags;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].ButtonFlags = mouse_stroke[i].state;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].ButtonData = mouse_stroke[i].rolling;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].RawButtons = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].LastX = mouse_stroke[i].x;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].LastY = mouse_stroke[i].y;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rawstrokes[i].ExtraInformation = mouse_stroke[i].information;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;DeviceIoControl(device_array[device - 1].handle, IOCTL_WRITE, rawstrokes, (DWORD)nstroke * sizeof(MOUSE_INPUT_DATA), NULL, 0, &amp;strokeswritten, NULL);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;HeapFree(GetProcessHeap(), 0, &nbsp;rawstrokes);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;strokeswritten /= sizeof(MOUSE_INPUT_DATA);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return strokeswritten;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;<a class='tag-url' href='https://forum.sources.ru/index.php?showtopic=416775' target='_blank'>Программирование драйверов Windows</a>&quot;</span></span>]]></description>
        <author>Wound</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820581</guid>
        <pubDate>Fri, 07 Feb 2020 08:25:11 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820581</link>
        <description><![CDATA[JoeUser: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820580'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Wound &#064; <time class="tag-quote__quoted-time" datetime="2020-02-07T08:23:34+00:00">07.02.20, 08:23</time></span><div class='quote '>The following sample allows one to query for a device’s “hardware id”, which may help on disambiguation of device input.<br>
Just remember this hardware id’s are not required to be unique, but mostly will when you have at last two different device models.</div></div><br>
Хм ... интересно. Щяс заценим&#33;  :)<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;<a class='tag-url' href='https://forum.sources.ru/index.php?showtopic=416775' target='_blank'>Программирование драйверов Windows</a>&quot;</span></span>]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820580</guid>
        <pubDate>Fri, 07 Feb 2020 08:23:34 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820580</link>
        <description><![CDATA[Wound: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820579'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>JoeUser &#064; <time class="tag-quote__quoted-time" datetime="2020-02-07T08:14:05+00:00">07.02.20, 08:14</time></span><div class='quote '>Не пробовал. Пробежал по коду глазами, но так и не увидел в коде как указать от какой именно клавиатуры начать перехват. Когда я КартРидер включаю - у меня он виндой определяется как HID Keyboard. Ну это примерно тоже самое, как ести ты воткнешь в системник вторую USB-клаву - обе работать будут.</div></div><br>
<br>
Так там в доке все есть. Ты бы запустил тестовый пример хотя бы, который одну клаву обрабатывает, и поигрался бы ))<br>
Вот тут же есть куча примеров даже с описанием: <a class='tag-url' href='http://www.oblita.com/interception.html' target='_blank'>http://www.oblita.com/interception.html</a><br>
<br>
Например:<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '><br>
The following sample allows one to query for a device’s “hardware id”, which may help on disambiguation of device input.<br>
Just remember this hardware id’s are not required to be unique, but mostly will when you have at last two different device models.<br>
</div></div><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">#include &#60;interception.h&#62;</div><div class="code_line">#include &quot;utils.h&quot;</div><div class="code_line">&nbsp;</div><div class="code_line">#include &#60;iostream&#62;</div><div class="code_line">&nbsp;</div><div class="code_line">enum ScanCode</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;SCANCODE_ESC = 0x01</div><div class="code_line">};</div><div class="code_line">&nbsp;</div><div class="code_line">int main()</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;using namespace std;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;InterceptionContext context;</div><div class="code_line">&nbsp;&nbsp; &nbsp;InterceptionDevice device;</div><div class="code_line">&nbsp;&nbsp; &nbsp;InterceptionStroke stroke;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;wchar_t hardware_id[500];</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;raise_process_priority();</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;context = interception_create_context();</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;interception_set_filter(context, interception_is_keyboard, INTERCEPTION_FILTER_KEY_DOWN | INTERCEPTION_FILTER_KEY_UP);</div><div class="code_line">&nbsp;&nbsp; &nbsp;interception_set_filter(context, interception_is_mouse, INTERCEPTION_FILTER_MOUSE_LEFT_BUTTON_DOWN);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;while(interception_receive(context, device = interception_wait(context), &amp;stroke, 1) &#62; 0)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(interception_is_keyboard(device))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;InterceptionKeyStroke &amp;keystroke = *(InterceptionKeyStroke *) &stroke;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(keystroke.code == SCANCODE_ESC) break;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;size_t length = interception_get_hardware_id(context, device, hardware_id, sizeof(hardware_id));</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(length &#62; 0 &amp;&amp; length &#60; sizeof(hardware_id))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;wcout &#60;&#60; hardware_id &#60;&#60; endl;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;interception_send(context, device, &amp;stroke, 1);</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;interception_destroy_context(context);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;return 0;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;<a class='tag-url' href='https://forum.sources.ru/index.php?showtopic=416775' target='_blank'>Программирование драйверов Windows</a>&quot;</span></span>]]></description>
        <author>Wound</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820579</guid>
        <pubDate>Fri, 07 Feb 2020 08:14:05 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820579</link>
        <description><![CDATA[JoeUser: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820564'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Wound &#064; <time class="tag-quote__quoted-time" datetime="2020-02-07T06:47:36+00:00">07.02.20, 06:47</time></span><div class='quote '>Я тебе уже давал ссылку на библиотеку: Захват USB-клавиатуры<br>
Судя по всему, ты ее так и не попробовал проверить? </div></div><br>
Не пробовал. Пробежал по коду глазами, но так и не увидел в коде как указать от какой именно клавиатуры начать перехват. Когда я КартРидер включаю - у меня он виндой определяется как HID Keyboard. Ну это примерно тоже самое, как ести ты воткнешь в системник вторую USB-клаву - обе работать будут.<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;<a class='tag-url' href='https://forum.sources.ru/index.php?showtopic=416775' target='_blank'>Программирование драйверов Windows</a>&quot;</span></span>]]></description>
        <author>JoeUser</author>
        <category>C/C++: Прочее</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820564</guid>
        <pubDate>Fri, 07 Feb 2020 06:47:36 +0000</pubDate>
        <title>Использование библиотеки Interception</title>
        <link>https://forum.sources.ru/index.php?showtopic=416823&amp;view=findpost&amp;p=3820564</link>
        <description><![CDATA[Wound: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=416823&view=findpost&p=3820555'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>JoeUser &#064; <time class="tag-quote__quoted-time" datetime="2020-02-07T05:22:28+00:00">07.02.20, 05:22</time></span><div class='quote '>Передо мной лежит устройство - USB Card Reader. В системе оно распознается как HID Keyboard. Мне нужно написать небольшую программу, которая будет пользоваться этим устройством. Но основной затык в том, что программа должна им пользоваться единолично&#33; Т.е. каким-то образом его &quot;захватить&quot;. И если будет активным другое приложение - весь вывод с устройства должен идти в мою программу. Без &quot;захвата&quot; устройство работает как обычная клава. К примеру, если будет активным окно ворда, после считывания магнитной карты, данные с устройства запишутся в ворд.</div></div><br>
Я тебе уже давал ссылку на библиотеку: <a class='tag-url' href='https://forum.sources.ru/index.php?showtopic=415108' target='_blank'>Захват USB-клавиатуры</a><br>
Судя по всему, ты ее так и не попробовал проверить?  :D <br>
У меня эта библиотека работала на 5+, захватывает мышь, клавиатуру, по твоему выбору(скорее всего даже джостик может захватить). Можно блокировать устройство так, чтоб дальше твоей программы - сообщения от устройства не шли. <br>
Я бы все таки попробовал проверить эту либу с твоим устройством. И если не поможет, уже тогда бы смотрел в сторону написания своего драйвера. <br>
<br>
<span class="tag-color tag-color-named" data-value="mergepost" style="color: mergepost"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2020-02-07T06:50:28+00:00">07.02.20, 06:50</time></span></span><br>
Хотя, если у тебя это устройство в системе распознается как &quot;нераспознаное&quot;(в смысле что на него не установлены драйвера), возможно эта библиотека и не подойдет, но мне кажется всетаки подойдет. Она свой драйвер ставит в систему. Т.е. по идее она должна видеть устройства даже без драйверов.<br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Это сообщение было перенесено сюда или объединено из темы &quot;<a class='tag-url' href='https://forum.sources.ru/index.php?showtopic=416775' target='_blank'>Программирование драйверов Windows</a>&quot;</span></span>]]></description>
        <author>Wound</author>
        <category>C/C++: Прочее</category>
      </item>
	
      </channel>
      </rss>
	