{"id":329525,"date":"2022-02-14T03:00:12","date_gmt":"2022-02-14T03:00:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=329525"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=329525","title":{"rendered":"<span>\u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u043e\u0439 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b \u043f\u0440\u0438 \u0441\u043c\u0435\u043d\u0435 \u044f\u0437\u044b\u043a\u0430 \u0432\u0432\u043e\u0434\u0430<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043a\u0443\u043f\u0438\u043b \u0441\u0435\u0431\u0435 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u043e\u0442 Corsair \u043c\u043e\u0434\u0435\u043b\u0438 <a href=\"https:\/\/www.corsair.com\/ru\/ru\/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D0%B8\/%D0%9F%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D1%8B\/%D0%98%D0%B3%D1%80%D0%BE%D0%B2%D1%8B%D0%B5-%D0%BA%D0%BB%D0%B0%D0%B2%D0%B8%D0%B0%D1%82%D1%83%D1%80%D1%8B\/%D0%A1%D1%82%D0%B0%D0%BD%D0%B4%D0%B0%D1%80%D1%82%D0%BD%D1%8B%D0%B5-%D0%B8%D0%B3%D1%80%D0%BE%D0%B2%D1%8B%D0%B5-%D0%BA%D0%BB%D0%B0%D0%B2%D0%B8%D0%B0%D1%82%D1%83%D1%80%D1%8B\/%D0%98%D0%B3%D1%80%D0%BE%D0%B2%D0%B0%D1%8F-%D0%BA%D0%BB%D0%B0%D0%B2%D0%B8%D0%B0%D1%82%D1%83%D1%80%D0%B0-K55-RGB-PRO\/p\/CH-9226765-NA\" rel=\"noopener noreferrer nofollow\">K55 RGB Pro<\/a>. \u0423 \u043d\u0435\u0435 \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u043d\u0430\u044f \u043d\u044b\u043d\u0447\u0435 \u0446\u0432\u0435\u0442\u043d\u0430\u044f \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0430, \u0430 \u0447\u0442\u043e\u0431\u044b \u0435\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 <a href=\"https:\/\/www.corsair.com\/ru\/ru\/icue\" rel=\"noopener noreferrer nofollow\">iCUE<\/a>. \u041d\u0430 \u0441\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0433\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u0413\u0443\u0433\u043b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b <a href=\"https:\/\/github.com\/CorsairOfficial\/cue-sdk\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 SDK<\/a> \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 <a href=\"https:\/\/corsairofficial.github.io\/cue-sdk\/\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a>. \u042f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u0434\u043b\u044f \u0441\u0435\u0431\u044f, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 Windows.<\/p>\n<p>\u041c\u043e\u0439 \u043a\u043e\u0434 (\u0434\u043b\u044f Visual Studio) \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/sokolas\/CueLang\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<hr\/>\n<details class=\"spoiler\">\n<summary>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a<\/summary>\n<div class=\"spoiler__content\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/620991e05af7f3126792b56c\" data-style=\"\" id=\"620991e05af7f3126792b56c\" width=\"\"><\/div>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0435\u0439, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0437\u0430\u0438\u043d\u043a\u043b\u044e\u0434\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c dll \u0440\u044f\u0434\u043e\u043c \u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439. \u0412 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0438\u0434\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u0441\u0438\u0439, \u044f \u0432\u0437\u044f\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e, CUESDK_2019 \u0434\u043b\u044f 32 \u0431\u0438\u0442.<\/p>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0432\u044b\u0437\u043e\u0432\u0430 <code>CorsairPerformProtocolHandshake()<\/code>. \u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a, <code>CorsairGetLastError()<\/code> \u0432\u0435\u0440\u043d\u0435\u0442 \u043a\u043e\u0434 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<pre><code class=\"cpp\">CorsairPerformProtocolHandshake();     if (const auto error = CorsairGetLastError()) {         std::cout &lt;&lt; \"Handshake failed: \" &lt;&lt; toString(error) &lt;&lt; std::endl;         return 2;     }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 toString &#8212; \u043e\u0431\u044b\u0447\u043d\u044b\u0439 switch-case, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e \u043a\u043e\u0434\u0443. \u041e\u0448\u0438\u0431\u043e\u043a \u0432\u0441\u0435\u0433\u043e 6, \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0438\u0445 \u0437\u0434\u0435\u0441\u044c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e <a href=\"https:\/\/github.com\/CorsairOfficial\/cue-sdk\/blob\/master\/src\/examples\/color_pulse\/color_pulse\/color_pulse.cpp#L26\" rel=\"noopener noreferrer nofollow\">\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/a>.<\/p>\n<p>\u041a \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0443 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439 ID, \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0446\u0432\u0435\u0442, \u0438 \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e. \u0412\u043e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434:<\/p>\n<pre><code class=\"cpp\">struct CorsairLedPosition { CorsairLedId ledId;\/\/ identifier of led. double top; double left; double height; double width;\/\/ values in mm. };<\/code><\/pre>\n<p>\u042f \u0445\u043e\u0447\u0443 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043c\u0435\u043d\u044f\u0442\u044c \u0446\u0432\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435\u043c \u0434\u0438\u043e\u0434\u0430\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432. \u041c\u0435\u043d\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0438\u0445 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u043e, \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0437\u043d\u0430\u044f \u0435\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u0444\u043b\u0430\u0433 \u0441\u0442\u0440\u0430\u043d\u044b \u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0437\u043e\u0432\u0435\u043c <code>CorsairGetDeviceCount()<\/code>, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443 \u043d\u0430\u0441 \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0439 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0438, \u0438, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0432\u044b\u0437\u043e\u0432\u0435\u043c <code>CorsairGetLedPositionsByDeviceIndex(i)<\/code> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e, \u0438 \u044f \u043f\u0435\u0440\u0435\u0434\u0430\u044e i=0. \u0412 <a href=\"https:\/\/github.com\/CorsairOfficial\/cue-sdk\/blob\/master\/src\/examples\/color_pulse\/color_pulse\/color_pulse.cpp#L50\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438. \u0421\u0440\u0430\u0437\u0443 \u0436\u0435, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043d\u0430\u043c \u0446\u0432\u0435\u0442\u0430\u043c\u0438 (<a href=\"https:\/\/github.com\/CorsairOfficial\/cue-sdk\/blob\/master\/src\/include\/CUESDK.h#L228\" rel=\"noopener noreferrer nofollow\">CorsairLedColor<\/a>)<\/p>\n<pre><code class=\"cpp\">void getAllLeds() {     if (CorsairGetDeviceCount() > 0) {         if (const auto ledPositions = CorsairGetLedPositionsByDeviceIndex(0)) {             for (auto i = 0; i &lt; ledPositions->numberOfLed; i++) {                 const auto ledId = ledPositions->pLedPosition[i].ledId;                 leds1.push_back(CorsairLedColor{ ledId, en_r, en_g, en_b });                 leds2.push_back(CorsairLedColor{ ledId, ru_r, ru_g, ru_b });             }         }     } }<\/code><\/pre>\n<p>\u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0434\u0432\u0430 \u044f\u0437\u044b\u043a\u0430 \u0432\u0432\u043e\u0434\u0430, \u0434\u043b\u044f \u043d\u0438\u0445 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u0432\u0430 \u043f\u0440\u0435\u0441\u0435\u0442\u0430: <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/CueLang\/cuelang3.cpp#L30\" rel=\"noopener noreferrer nofollow\">\u0433\u043e\u043b\u0443\u0431\u043e\u0439 <\/a>\u0434\u043b\u044f \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e \u0438 <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/CueLang\/cuelang3.cpp#L34\" rel=\"noopener noreferrer nofollow\">\u043e\u0440\u0430\u043d\u0436\u0435\u0432\u044b\u0439 <\/a>\u0434\u043b\u044f \u0440\u0443\u0441\u0441\u043a\u043e\u0433\u043e.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0446\u0432\u0435\u0442, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>CorsairSetLedsColorsBufferByDeviceIndex<\/code> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0442\u0443\u0434\u0430 \u0438\u043d\u0434\u0435\u043a\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 (\u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 0 &#8212; \u0443 \u043c\u0435\u043d\u044f \u043e\u043d\u043e \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e) \u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 <code>CorsairLedColor<\/code>-\u043e\u0432.<\/p>\n<pre><code>CorsairSetLedsColorsBufferByDeviceIndex(0, static_cast&lt;int>(leds1.size()), leds2.data());<\/code><\/pre>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0442\u0443\u043f\u044f\u0442 \u0432 \u0441\u0438\u043b\u0443, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u0432\u044b\u0437\u043e\u0432\u0435\u043c <code>CorsairSetLedsColorsFlushBuffer()<\/code>.<\/p>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0436\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0434 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442. \u041d\u043e \u044f \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u0446\u0432\u0435\u0442 \u043c\u0435\u043d\u044f\u043b\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u044f\u0437\u044b\u043a\u0430. <\/p>\n<h2>\u041a\u0430\u043a \u0443\u0437\u043d\u0430\u0442\u044c \u044f\u0437\u044b\u043a \u0432\u0432\u043e\u0434\u0430?<\/h2>\n<p>\u041e, \u0430 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c. \u0418\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a winapi, \u0443 \u043c\u0435\u043d\u044f \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/api\/winuser\/nf-winuser-setwindowshookexa\" rel=\"noopener noreferrer nofollow\">SetWindowsHookEx<\/a> \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <code>WH_SHELL<\/code>. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435, \u0435\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/windows\/desktop\/legacy\/ms644991(v=vs.85)\" rel=\"noopener noreferrer nofollow\">ShellProc<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u043e\u0439 windows.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>nCode<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>HSHELL_LANGUAGE<\/code>, \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0435, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043c\u0435\u043d\u0438\u043b \u044f\u0437\u044b\u043a \u0432\u0432\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>Handle \u044f\u0437\u044b\u043a\u0430 \u0432\u0432\u043e\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 <code>lParam<\/code>. \u042f \u043d\u0435 \u0441\u043c\u043e\u0433 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u043e\u0442\u0447\u0430\u0441\u0442\u0438 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u044d\u0442\u0430 \u0448\u0442\u0443\u043a\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 (handle to a keyboard layout, input language handle). \u041e\u0434\u043d\u0430\u043a\u043e, \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044f\u0437\u044b\u043a\u0443 (\u043c\u0435\u0442\u043e\u0434\u0443 \u0432\u0432\u043e\u0434\u0430) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u0438 \u0434\u0430\u0436\u0435 \u043e\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/CueLang\/cuelang3.cpp#L25\" rel=\"noopener noreferrer nofollow\">\u0432 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/a> (\u0438\u043b\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433).<\/p>\n<\/li>\n<\/ol>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u0443\u043a\u0430 \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 DLL. \u042d\u0442\u0430 DLL \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u043e \u0432\u0441\u0435\u043c \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u0436\u0438\u0432\u0435\u043c \u0432 \u0432\u0435\u043a 64-\u0431\u0438\u0442\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u0438 \u044d\u0442\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u0422\u0430\u043a, \u0432 64-\u0431\u0438\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e 64-\u0431\u0438\u0442\u043d\u044b\u0435 DLL, \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0432\u0435\u0437\u0434\u0435, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u0432\u0435 DLL \u0440\u0430\u0437\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0438 \u0434\u0432\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0445 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0442\u044c\/\u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0442\u044c. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 DLL \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/github.com\/sokolas\/CueLang\/tree\/master\/ShellHook\" rel=\"noopener noreferrer nofollow\">ShellHook<\/a>. \u0415\u0433\u043e \u043a\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439. \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0445\u0443\u043a\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">extern \"C\" SHELLHOOK_API void install() {     hook = SetWindowsHookEx(WH_SHELL, hookproc, module, 0); }  extern \"C\" SHELLHOOK_API void uninstall() {     UnhookWindowsHookEx(hook); }<\/code><\/pre>\n<p>SHELLHOOK_API \u043e\u043f\u0438\u0441\u0430\u043d \u0440\u044f\u0434\u043e\u043c \u0432 <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/ShellHook\/Shellhook.h\" rel=\"noopener noreferrer nofollow\">\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u043a\u043b\u044e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u0442\u0443 DLL. \u042d\u0442\u043e <a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/build\/walkthrough-creating-and-using-a-dynamic-link-library-cpp?view=msvc-170\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/a> \u0434\u043b\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u0430\u043a \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b: \u0442\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043c\u043f\u043e\u0440\u0442 \u0438\u043b\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0438\u043d\u043a\u043b\u044e\u0434\u0438\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438.<\/p>\n<p>\u041f\u0440\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u0445\u0443\u043a\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/ShellHook\/dllmain.cpp#L18\" rel=\"noopener noreferrer nofollow\">hookproc<\/a> \u0438\u0437 \u044d\u0442\u043e\u0439 \u0436\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0442\u0430\u0449\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0432 DLL, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0447\u0435\u0440\u0435\u0437 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u043a\u043d\u0443 \u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0438 \u0441\u043c\u0435\u043d\u044b \u044f\u0437\u044b\u043a\u0430, \u0430 \u043e\u043d\u043e \u0442\u0430\u043c \u0443\u0436\u0435 \u0441\u0430\u043c\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441 \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">extern \"C\" LRESULT CALLBACK hookproc(int nCode, WPARAM wParam, LPARAM lParam) {     if (nCode &lt; 0) \/\/ do not process message         return CallNextHookEx(hook, nCode,             wParam, lParam);     switch (nCode)     {     case HSHELL_LANGUAGE:     {         HWND wnd = FindWindow(L\"CueLangApp\", L\"CueLangApp\");    \/\/ we're hard-coding the strings here for simplicity         if (wnd != NULL)             PostMessage(wnd, WM_USER + 1, wParam, lParam);     }     default:         break;     }      return CallNextHookEx(hook, nCode, wParam, lParam); }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u0448\u0435, ShellHook.dll \u043d\u0430\u0434\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440, x86 \u0438 x64. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0445\u0443\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438, \u044d\u0442\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u0443\u0444\u0444\u0438\u043a\u0441 <code>.x64<\/code> \u0434\u043b\u044f 64-\u0431\u0438\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 &#8212; \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Target name \u0432 <code>$(ProjectName).x64<\/code> \u0434\u043b\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b x64.<\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u044d\u0442\u043e\u0439 DLL \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0415\u0433\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0441\u0442\u0430: \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>install<\/code>, \u0436\u0434\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438, \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>uninstall<\/code>. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043b\u0438\u0431\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 LIB-\u0444\u0430\u0439\u043b, \u043b\u0438\u0431\u043e \u043f\u043e\u0434\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/api\/libloaderapi\/nf-libloaderapi-loadlibraryw\" rel=\"noopener noreferrer nofollow\">LoadLibrary<\/a>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. <\/p>\n<pre><code class=\"cpp\">HMODULE dll = LoadLibrary(HOOKLIBNAME); if (dll == NULL) return 2;  install_ = (InstallProc)GetProcAddress(dll, \"install\"); uninstall_ = (UninstallProc)GetProcAddress(dll, \"uninstall\");  install_();<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0438\u043c\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u043c Visual Studio <code>_WIN64<\/code>:<\/p>\n<pre><code class=\"cpp\">#if _WIN64 #define HOOKLIBNAME L\"ShellHook.x64.dll\" #else #define HOOKLIBNAME L\"ShellHook.dll\" #endif<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0438 \u0435\u043c\u0443 \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u0442\u044c \u043e\u043a\u043d\u043e \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043a\u0430\u043a-\u0442\u043e \u043e\u0442\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c. \u041e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 windows \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u0430 \u043a \u0442\u0440\u0435\u0434\u0443, \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0446\u0438\u043a\u043b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043f\u0440\u044f\u043c\u043e \u0432 WinMain:<\/p>\n<pre><code class=\"cpp\">while (GetMessage(&amp;msg, NULL, 0, 0) > 0) { if (msg.message == WM_CLOSE) { break; } }<\/code><\/pre>\n<p>Windows \u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e WM_CLOSE \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u0431\u0435\u0437 \u043e\u043a\u043d\u0430, \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u043d\u0438\u043c\u0435\u043c \u0445\u0443\u043a \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b:<\/p>\n<pre><code class=\"cpp\">uninstall_(); FreeLibrary(dll);<\/code><\/pre>\n<h2>\u041a\u0430\u043a \u044d\u0442\u0438\u043c \u0432\u0441\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c?<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0432\u0441\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043d\u0430\u043c \u043d\u0430\u0434\u043e:<\/p>\n<ol>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0431\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 HookSupportApp<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f <code>WM_USER+1<\/code> \u0438\u0437 \u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0430 \u0445\u0443\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u0438 \u0441\u043d\u044f\u0442\u044c \u0445\u0443\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043a\u0440\u044b\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u043c <a href=\"https:\/\/github.com\/sokolas\/CueLang\/tree\/master\/CueLang\" rel=\"noopener noreferrer nofollow\">\u0442\u0440\u0435\u0442\u044c\u0435, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/a>. \u041e\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (\u043c\u043d\u0435 \u0442\u0430\u043a \u0431\u044b\u043b\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0434\u0435\u0431\u0430\u0436\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u043e\u0448\u0438\u0431\u043a\u0438), \u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u043e\u0435 \u043e\u043a\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u044f\u0437\u044b\u043a\u0430. \u0412 \u043d\u0435\u043c \u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u044f\u0437\u044b\u043a\u0438, \u0446\u0432\u0435\u0442\u0430 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 CUE SDK, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. \u041a\u043e\u0434, \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0431\u044a\u0435\u043c\u043d\u044b\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u043c\u0441\u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0438\u043c <a href=\"https:\/\/github.com\/sokolas\/CueLang\/tree\/master\/CueLang\" rel=\"noopener noreferrer nofollow\">\u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<\/a>, \u0430 \u043d\u0438\u0436\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u0442\u043e, \u0447\u0442\u043e, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0434\u043e\u0441\u0442\u043e\u0439\u043d\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0422\u043e\u0447\u043a\u043e\u0439 \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/CueLang\/cuelang3.cpp#L160\" rel=\"noopener noreferrer nofollow\">main<\/a>. \u0412\u043d\u0443\u0442\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a CUE \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0446\u0432\u0435\u0442\u0430 \u0434\u043b\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432. \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u043e\u0435 \u043e\u043a\u043d\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">WNDCLASS wc = {}; wc.lpfnWndProc = WndProc; wc.hInstance = hInstance; wc.lpszClassName = CLASS_NAME;  RegisterClass(&amp;wc);  hwnd = CreateWindowEx(     0,     CLASS_NAME,     L\"CueLangApp\",     WS_OVERLAPPEDWINDOW,     CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,     NULL,     NULL,     hInstance,     NULL ); if (hwnd == NULL) {     return 0; } ShowWindow(hwnd, SW_HIDE);<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435 \u0436\u0435 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u043e\u043a\u043d\u0430 \u0438 \u0435\u0433\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0432 <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/ShellHook\/dllmain.cpp#L27\" rel=\"noopener noreferrer nofollow\">FindWindow \u0432\u043d\u0443\u0442\u0440\u0438 DLL<\/a>, \u0438\u043d\u0430\u0447\u0435 \u043e\u043a\u043d\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442\u0441\u044f. <code>WndProc<\/code> \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043e\u043a\u043d\u0430, \u043d\u0430 \u0432\u0441\u0435 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>DefWindowProc<\/code>, \u043a\u0440\u043e\u043c\u0435 \u0434\u0432\u0443\u0445, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043d\u0430\u043c: <code>WM_CLOSE<\/code> \u043d\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043e\u043a\u043d\u0430 \u0438 <code>WM_USER+1<\/code> \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044f\u0437\u044b\u043a\u0430.<\/p>\n<pre><code class=\"cpp\">LRESULT CALLBACK WndProc(     _In_ HWND hWnd,     _In_ UINT message,     _In_ WPARAM wParam,     _In_ LPARAM lParam ) {     switch (message)     {     case WM_USER + 1:         changeLang(wParam, lParam);         break;     case WM_CLOSE:         PostQuitMessage(0);     default:         return DefWindowProc(hWnd, message, wParam, lParam);     }     return 0; }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0437\u0430 \u0445\u0443\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/api\/processthreadsapi\/nf-processthreadsapi-createprocessw\" rel=\"noopener noreferrer nofollow\">CreateProcess<\/a>:<\/p>\n<pre><code class=\"cpp\">STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory(&amp;si, sizeof(si)); si.cb = sizeof(si); ZeroMemory(&amp;pi, sizeof(pi));  if (!CreateProcess(NULL,   \/\/ No module name (use command line)         &amp;childexe[0],        \/\/ Command line         NULL,           \/\/ Process handle not inheritable         NULL,           \/\/ Thread handle not inheritable         FALSE,          \/\/ Set handle inheritance to FALSE         0,              \/\/ No creation flags         NULL,           \/\/ Use parent's environment block         NULL,           \/\/ Use parent's starting directory          &amp;si,            \/\/ Pointer to STARTUPINFO structure         &amp;pi)           \/\/ Pointer to PROCESS_INFORMATION structure         ) {     printf(\"CreateProcess 32 failed (%d).\\n\", GetLastError());     return 1; } \/\/... childThread32 = GetThreadId(pi.hThread);<\/code><\/pre>\n<p><code>childThread32<\/code> \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u043c\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435:<\/p>\n<pre><code class=\"cpp\">PostThreadMessage(childThread32, WM_CLOSE, 0, 0);<\/code><\/pre>\n<p>\u0415\u0449\u0435 \u043e\u0434\u043d\u0430 \u0434\u0435\u0442\u0430\u043b\u044c: \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u043e, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043a\u0430\u043a-\u0442\u043e \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c (CTRL-C, \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043e\u043a\u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0438 \u0442.\u0434.). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0442\u0430\u043a\u0438\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/CueLang\/cuelang3.cpp#L39\" rel=\"noopener noreferrer nofollow\">CtrlHandler<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>SetConsoleCtrlHandler(CtrlHandler, TRUE)<\/code>.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u043a\u043d\u043e \u0438 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u044b, \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b, \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a CUE SDK \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0446\u0438\u043a\u043b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0417\u0434\u0435\u0441\u044c \u043e\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u0432 <code>HookSupportApp<\/code>, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>DispatchMessage()<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u043a\u043d\u043e \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u044f \u043d\u0435\u0433\u043e <code>WndProc<\/code>.<\/p>\n<pre><code>while (GetMessage(&amp;msg, NULL, 0, 0) > 0) {     TranslateMessage(&amp;msg);     DispatchMessage(&amp;msg); }<\/code><\/pre>\n<p>\u0412\u043e\u0442, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0438 \u0432\u0441\u0435. \u0417\u0434\u0435\u0441\u044c \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0440 \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0439: \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 GUI \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0438 \u044f\u0437\u044b\u043a\u043e\u0432, \u043a\u043e\u043d\u0444\u0438\u0433, \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0435 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 &#8212; \u0432\u0441\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0439\u0442\u0438 \u0432\u0430\u043c \u0432 \u0433\u043e\u043b\u043e\u0432\u0443!<\/p>\n<hr\/>\n<p>\u0421\u043f\u0438\u0441\u043e\u043a \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u043b\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c.<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/CorsairOfficial\/cue-sdk\/tree\/master\/src\/examples\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/CorsairOfficial\/cue-sdk\/tree\/master\/src\/examples<\/a> &#8212; \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 CUE SDK<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/corsairofficial.github.io\/cue-sdk\/\" rel=\"noopener noreferrer nofollow\">https:\/\/corsairofficial.github.io\/cue-sdk\/<\/a> &#8212; \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f CUE SDK<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0442 <a href=\"https:\/\/sudonull.com\/post\/101942-Keyboard-layout-indicator-with-the-color-of-the-taskbar-and-window-title-in-modern-versions-of-Windo\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f<\/a> \u043e\u0442 Alexander Shestakov, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0430\u0432\u0442\u043e\u0440 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438 \u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/651317\/\"> https:\/\/habr.com\/ru\/post\/651317\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043a\u0443\u043f\u0438\u043b \u0441\u0435\u0431\u0435 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u043e\u0442 Corsair \u043c\u043e\u0434\u0435\u043b\u0438 <a href=\"https:\/\/www.corsair.com\/ru\/ru\/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D0%B8\/%D0%9F%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D1%8B\/%D0%98%D0%B3%D1%80%D0%BE%D0%B2%D1%8B%D0%B5-%D0%BA%D0%BB%D0%B0%D0%B2%D0%B8%D0%B0%D1%82%D1%83%D1%80%D1%8B\/%D0%A1%D1%82%D0%B0%D0%BD%D0%B4%D0%B0%D1%80%D1%82%D0%BD%D1%8B%D0%B5-%D0%B8%D0%B3%D1%80%D0%BE%D0%B2%D1%8B%D0%B5-%D0%BA%D0%BB%D0%B0%D0%B2%D0%B8%D0%B0%D1%82%D1%83%D1%80%D1%8B\/%D0%98%D0%B3%D1%80%D0%BE%D0%B2%D0%B0%D1%8F-%D0%BA%D0%BB%D0%B0%D0%B2%D0%B8%D0%B0%D1%82%D1%83%D1%80%D0%B0-K55-RGB-PRO\/p\/CH-9226765-NA\" rel=\"noopener noreferrer nofollow\">K55 RGB Pro<\/a>. \u0423 \u043d\u0435\u0435 \u0435\u0441\u0442\u044c \u043c\u043e\u0434\u043d\u0430\u044f \u043d\u044b\u043d\u0447\u0435 \u0446\u0432\u0435\u0442\u043d\u0430\u044f \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0430, \u0430 \u0447\u0442\u043e\u0431\u044b \u0435\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 <a href=\"https:\/\/www.corsair.com\/ru\/ru\/icue\" rel=\"noopener noreferrer nofollow\">iCUE<\/a>. \u041d\u0430 \u0441\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0433\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u043e\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u0413\u0443\u0433\u043b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b <a href=\"https:\/\/github.com\/CorsairOfficial\/cue-sdk\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 SDK<\/a> \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 <a href=\"https:\/\/corsairofficial.github.io\/cue-sdk\/\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a>. \u042f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u0434\u043b\u044f \u0441\u0435\u0431\u044f, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 Windows.<\/p>\n<p>\u041c\u043e\u0439 \u043a\u043e\u0434 (\u0434\u043b\u044f Visual Studio) \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/sokolas\/CueLang\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<hr\/>\n<details class=\"spoiler\">\n<summary>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0432\u043e\u0442 \u0442\u0430\u043a<\/summary>\n<div class=\"spoiler__content\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/620991e05af7f3126792b56c\" data-style=\"\" id=\"620991e05af7f3126792b56c\" width=\"\"><\/div>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0435\u0439, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0437\u0430\u0438\u043d\u043a\u043b\u044e\u0434\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c dll \u0440\u044f\u0434\u043e\u043c \u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439. \u0412 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0438\u0434\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u0441\u0438\u0439, \u044f \u0432\u0437\u044f\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e, CUESDK_2019 \u0434\u043b\u044f 32 \u0431\u0438\u0442.<\/p>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0432\u044b\u0437\u043e\u0432\u0430 <code>CorsairPerformProtocolHandshake()<\/code>. \u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a, <code>CorsairGetLastError()<\/code> \u0432\u0435\u0440\u043d\u0435\u0442 \u043a\u043e\u0434 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<pre><code class=\"cpp\">CorsairPerformProtocolHandshake();     if (const auto error = CorsairGetLastError()) {         std::cout &lt;&lt; \"Handshake failed: \" &lt;&lt; toString(error) &lt;&lt; std::endl;         return 2;     }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 toString &#8212; \u043e\u0431\u044b\u0447\u043d\u044b\u0439 switch-case, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e \u043a\u043e\u0434\u0443. \u041e\u0448\u0438\u0431\u043e\u043a \u0432\u0441\u0435\u0433\u043e 6, \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0438\u0445 \u0437\u0434\u0435\u0441\u044c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e <a href=\"https:\/\/github.com\/CorsairOfficial\/cue-sdk\/blob\/master\/src\/examples\/color_pulse\/color_pulse\/color_pulse.cpp#L26\" rel=\"noopener noreferrer nofollow\">\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/a>.<\/p>\n<p>\u041a \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0443 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439 ID, \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0446\u0432\u0435\u0442, \u0438 \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e. \u0412\u043e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434:<\/p>\n<pre><code class=\"cpp\">struct CorsairLedPosition { CorsairLedId ledId;\/\/ identifier of led. double top; double left; double height; double width;\/\/ values in mm. };<\/code><\/pre>\n<p>\u042f \u0445\u043e\u0447\u0443 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043c\u0435\u043d\u044f\u0442\u044c \u0446\u0432\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435\u043c \u0434\u0438\u043e\u0434\u0430\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432. \u041c\u0435\u043d\u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0438\u0445 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u043e, \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0437\u043d\u0430\u044f \u0435\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u0444\u043b\u0430\u0433 \u0441\u0442\u0440\u0430\u043d\u044b \u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0437\u043e\u0432\u0435\u043c <code>CorsairGetDeviceCount()<\/code>, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443 \u043d\u0430\u0441 \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0439 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0438, \u0438, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0432\u044b\u0437\u043e\u0432\u0435\u043c <code>CorsairGetLedPositionsByDeviceIndex(i)<\/code> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e, \u0438 \u044f \u043f\u0435\u0440\u0435\u0434\u0430\u044e i=0. \u0412 <a href=\"https:\/\/github.com\/CorsairOfficial\/cue-sdk\/blob\/master\/src\/examples\/color_pulse\/color_pulse\/color_pulse.cpp#L50\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438. \u0421\u0440\u0430\u0437\u0443 \u0436\u0435, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043d\u0430\u043c \u0446\u0432\u0435\u0442\u0430\u043c\u0438 (<a href=\"https:\/\/github.com\/CorsairOfficial\/cue-sdk\/blob\/master\/src\/include\/CUESDK.h#L228\" rel=\"noopener noreferrer nofollow\">CorsairLedColor<\/a>)<\/p>\n<pre><code class=\"cpp\">void getAllLeds() {     if (CorsairGetDeviceCount() > 0) {         if (const auto ledPositions = CorsairGetLedPositionsByDeviceIndex(0)) {             for (auto i = 0; i &lt; ledPositions->numberOfLed; i++) {                 const auto ledId = ledPositions->pLedPosition[i].ledId;                 leds1.push_back(CorsairLedColor{ ledId, en_r, en_g, en_b });                 leds2.push_back(CorsairLedColor{ ledId, ru_r, ru_g, ru_b });             }         }     } }<\/code><\/pre>\n<p>\u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0434\u0432\u0430 \u044f\u0437\u044b\u043a\u0430 \u0432\u0432\u043e\u0434\u0430, \u0434\u043b\u044f \u043d\u0438\u0445 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u0432\u0430 \u043f\u0440\u0435\u0441\u0435\u0442\u0430: <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/CueLang\/cuelang3.cpp#L30\" rel=\"noopener noreferrer nofollow\">\u0433\u043e\u043b\u0443\u0431\u043e\u0439 <\/a>\u0434\u043b\u044f \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u0433\u043e \u0438 <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/CueLang\/cuelang3.cpp#L34\" rel=\"noopener noreferrer nofollow\">\u043e\u0440\u0430\u043d\u0436\u0435\u0432\u044b\u0439 <\/a>\u0434\u043b\u044f \u0440\u0443\u0441\u0441\u043a\u043e\u0433\u043e.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0446\u0432\u0435\u0442, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>CorsairSetLedsColorsBufferByDeviceIndex<\/code> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0442\u0443\u0434\u0430 \u0438\u043d\u0434\u0435\u043a\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 (\u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 0 &#8212; \u0443 \u043c\u0435\u043d\u044f \u043e\u043d\u043e \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e) \u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 <code>CorsairLedColor<\/code>-\u043e\u0432.<\/p>\n<pre><code>CorsairSetLedsColorsBufferByDeviceIndex(0, static_cast&lt;int>(leds1.size()), leds2.data());<\/code><\/pre>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0442\u0443\u043f\u044f\u0442 \u0432 \u0441\u0438\u043b\u0443, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u0432\u044b\u0437\u043e\u0432\u0435\u043c <code>CorsairSetLedsColorsFlushBuffer()<\/code>.<\/p>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0436\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0434 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442. \u041d\u043e \u044f \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u0446\u0432\u0435\u0442 \u043c\u0435\u043d\u044f\u043b\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u044f\u0437\u044b\u043a\u0430. <\/p>\n<h2>\u041a\u0430\u043a \u0443\u0437\u043d\u0430\u0442\u044c \u044f\u0437\u044b\u043a \u0432\u0432\u043e\u0434\u0430?<\/h2>\n<p>\u041e, \u0430 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c. \u0418\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a winapi, \u0443 \u043c\u0435\u043d\u044f \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d &#8212; \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/api\/winuser\/nf-winuser-setwindowshookexa\" rel=\"noopener noreferrer nofollow\">SetWindowsHookEx<\/a> \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <code>WH_SHELL<\/code>. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435, \u0435\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/windows\/desktop\/legacy\/ms644991(v=vs.85)\" rel=\"noopener noreferrer nofollow\">ShellProc<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u043e\u0439 windows.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>nCode<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>HSHELL_LANGUAGE<\/code>, \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0449\u0435\u0435, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043c\u0435\u043d\u0438\u043b \u044f\u0437\u044b\u043a \u0432\u0432\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>Handle \u044f\u0437\u044b\u043a\u0430 \u0432\u0432\u043e\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 <code>lParam<\/code>. \u042f \u043d\u0435 \u0441\u043c\u043e\u0433 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u043b\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u043e\u0442\u0447\u0430\u0441\u0442\u0438 \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u044d\u0442\u0430 \u0448\u0442\u0443\u043a\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 (handle to a keyboard layout, input language handle). \u041e\u0434\u043d\u0430\u043a\u043e, \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044f\u0437\u044b\u043a\u0443 (\u043c\u0435\u0442\u043e\u0434\u0443 \u0432\u0432\u043e\u0434\u0430) \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435, \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u0438 \u0434\u0430\u0436\u0435 \u043e\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/CueLang\/cuelang3.cpp#L25\" rel=\"noopener noreferrer nofollow\">\u0432 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b<\/a> (\u0438\u043b\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433).<\/p>\n<\/li>\n<\/ol>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u0443\u043a\u0430 \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 DLL. \u042d\u0442\u0430 DLL \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u043e \u0432\u0441\u0435\u043c \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u0436\u0438\u0432\u0435\u043c \u0432 \u0432\u0435\u043a 64-\u0431\u0438\u0442\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u0438 \u044d\u0442\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u0422\u0430\u043a, \u0432 64-\u0431\u0438\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e 64-\u0431\u0438\u0442\u043d\u044b\u0435 DLL, \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0432\u0435\u0437\u0434\u0435, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u0432\u0435 DLL \u0440\u0430\u0437\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0438 \u0434\u0432\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0445 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0442\u044c\/\u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0442\u044c. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 DLL \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/github.com\/sokolas\/CueLang\/tree\/master\/ShellHook\" rel=\"noopener noreferrer nofollow\">ShellHook<\/a>. \u0415\u0433\u043e \u043a\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439. \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0445\u0443\u043a\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">extern \"C\" SHELLHOOK_API void install() {     hook = SetWindowsHookEx(WH_SHELL, hookproc, module, 0); }  extern \"C\" SHELLHOOK_API void uninstall() {     UnhookWindowsHookEx(hook); }<\/code><\/pre>\n<p>SHELLHOOK_API \u043e\u043f\u0438\u0441\u0430\u043d \u0440\u044f\u0434\u043e\u043c \u0432 <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/ShellHook\/Shellhook.h\" rel=\"noopener noreferrer nofollow\">\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u043a\u043b\u044e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u0442\u0443 DLL. \u042d\u0442\u043e <a href=\"https:\/\/docs.microsoft.com\/en-us\/cpp\/build\/walkthrough-creating-and-using-a-dynamic-link-library-cpp?view=msvc-170\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/a> \u0434\u043b\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u0430\u043a \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b: \u0442\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043c\u043f\u043e\u0440\u0442 \u0438\u043b\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0438\u043d\u043a\u043b\u044e\u0434\u0438\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438.<\/p>\n<p>\u041f\u0440\u0438 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0438 \u0445\u0443\u043a\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/ShellHook\/dllmain.cpp#L18\" rel=\"noopener noreferrer nofollow\">hookproc<\/a> \u0438\u0437 \u044d\u0442\u043e\u0439 \u0436\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0442\u0430\u0449\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0432 DLL, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0447\u0435\u0440\u0435\u0437 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u043a\u043d\u0443 \u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0438 \u0441\u043c\u0435\u043d\u044b \u044f\u0437\u044b\u043a\u0430, \u0430 \u043e\u043d\u043e \u0442\u0430\u043c \u0443\u0436\u0435 \u0441\u0430\u043c\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441 \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">extern \"C\" LRESULT CALLBACK hookproc(int nCode, WPARAM wParam, LPARAM lParam) {     if (nCode &lt; 0) \/\/ do not process message         return CallNextHookEx(hook, nCode,             wParam, lParam);     switch (nCode)     {     case HSHELL_LANGUAGE:     {         HWND wnd = FindWindow(L\"CueLangApp\", L\"CueLangApp\");    \/\/ we're hard-coding the strings here for simplicity         if (wnd != NULL)             PostMessage(wnd, WM_USER + 1, wParam, lParam);     }     default:         break;     }      return CallNextHookEx(hook, nCode, wParam, lParam); }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u0448\u0435, ShellHook.dll \u043d\u0430\u0434\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440, x86 \u0438 x64. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0445\u0443\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438, \u044d\u0442\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u0443\u0444\u0444\u0438\u043a\u0441 <code>.x64<\/code> \u0434\u043b\u044f 64-\u0431\u0438\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 &#8212; \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Target name \u0432 <code>$(ProjectName).x64<\/code> \u0434\u043b\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b x64.<\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u044d\u0442\u043e\u0439 DLL \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0415\u0433\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0441\u0442\u0430: \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>install<\/code>, \u0436\u0434\u0430\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438, \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>uninstall<\/code>. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043b\u0438\u0431\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0447\u0435\u0440\u0435\u0437 LIB-\u0444\u0430\u0439\u043b, \u043b\u0438\u0431\u043e \u043f\u043e\u0434\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/api\/libloaderapi\/nf-libloaderapi-loadlibraryw\" rel=\"noopener noreferrer nofollow\">LoadLibrary<\/a>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. <\/p>\n<pre><code class=\"cpp\">HMODULE dll = LoadLibrary(HOOKLIBNAME); if (dll == NULL) return 2;  install_ = (InstallProc)GetProcAddress(dll, \"install\"); uninstall_ = (UninstallProc)GetProcAddress(dll, \"uninstall\");  install_();<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0438\u043c\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u043c Visual Studio <code>_WIN64<\/code>:<\/p>\n<pre><code class=\"cpp\">#if _WIN64 #define HOOKLIBNAME L\"ShellHook.x64.dll\" #else #define HOOKLIBNAME L\"ShellHook.dll\" #endif<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0438 \u0435\u043c\u0443 \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u0438\u043c\u0435\u0442\u044c \u043e\u043a\u043d\u043e \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043a\u0430\u043a-\u0442\u043e \u043e\u0442\u0441\u0432\u0435\u0447\u0438\u0432\u0430\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c. \u041e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 windows \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u0430 \u043a \u0442\u0440\u0435\u0434\u0443, \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0446\u0438\u043a\u043b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043f\u0440\u044f\u043c\u043e \u0432 WinMain:<\/p>\n<pre><code class=\"cpp\">while (GetMessage(&amp;msg, NULL, 0, 0) > 0) { if (msg.message == WM_CLOSE) { break; } }<\/code><\/pre>\n<p>Windows \u043d\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e WM_CLOSE \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u0431\u0435\u0437 \u043e\u043a\u043d\u0430, \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u043d\u0438\u043c\u0435\u043c \u0445\u0443\u043a \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b:<\/p>\n<pre><code class=\"cpp\">uninstall_(); FreeLibrary(dll);<\/code><\/pre>\n<h2>\u041a\u0430\u043a \u044d\u0442\u0438\u043c \u0432\u0441\u0435\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c?<\/h2>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0432\u0441\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043d\u0430\u043c \u043d\u0430\u0434\u043e:<\/p>\n<ol>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0431\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 HookSupportApp<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f <code>WM_USER+1<\/code> \u0438\u0437 \u043a\u043e\u043b\u043b\u0431\u044d\u043a\u0430 \u0445\u0443\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u0438 \u0441\u043d\u044f\u0442\u044c \u0445\u0443\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043a\u0440\u044b\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u043c <a href=\"https:\/\/github.com\/sokolas\/CueLang\/tree\/master\/CueLang\" rel=\"noopener noreferrer nofollow\">\u0442\u0440\u0435\u0442\u044c\u0435, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/a>. \u041e\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (\u043c\u043d\u0435 \u0442\u0430\u043a \u0431\u044b\u043b\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0434\u0435\u0431\u0430\u0436\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 \u043e\u0448\u0438\u0431\u043a\u0438), \u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u043e\u0435 \u043e\u043a\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u044f\u0437\u044b\u043a\u0430. \u0412 \u043d\u0435\u043c \u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u044f\u0437\u044b\u043a\u0438, \u0446\u0432\u0435\u0442\u0430 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 CUE SDK, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. \u041a\u043e\u0434, \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0431\u044a\u0435\u043c\u043d\u044b\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u043c\u0441\u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0438\u043c <a href=\"https:\/\/github.com\/sokolas\/CueLang\/tree\/master\/CueLang\" rel=\"noopener noreferrer nofollow\">\u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<\/a>, \u0430 \u043d\u0438\u0436\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u0442\u043e, \u0447\u0442\u043e, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0434\u043e\u0441\u0442\u043e\u0439\u043d\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0422\u043e\u0447\u043a\u043e\u0439 \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/CueLang\/cuelang3.cpp#L160\" rel=\"noopener noreferrer nofollow\">main<\/a>. \u0412\u043d\u0443\u0442\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a CUE \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0446\u0432\u0435\u0442\u0430 \u0434\u043b\u044f \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432. \u0417\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0435\u0432\u0438\u0434\u0438\u043c\u043e\u0435 \u043e\u043a\u043d\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">WNDCLASS wc = {}; wc.lpfnWndProc = WndProc; wc.hInstance = hInstance; wc.lpszClassName = CLASS_NAME;  RegisterClass(&amp;wc);  hwnd = CreateWindowEx(     0,     CLASS_NAME,     L\"CueLangApp\",     WS_OVERLAPPEDWINDOW,     CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,     NULL,     NULL,     hInstance,     NULL ); if (hwnd == NULL) {     return 0; } ShowWindow(hwnd, SW_HIDE);<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435 \u0436\u0435 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u043e\u043a\u043d\u0430 \u0438 \u0435\u0433\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0432 <a href=\"https:\/\/github.com\/sokolas\/CueLang\/blob\/master\/ShellHook\/dllmain.cpp#L27\" rel=\"noopener noreferrer nofollow\">FindWindow \u0432\u043d\u0443\u0442\u0440\u0438 DLL<\/a>, \u0438\u043d\u0430\u0447\u0435 \u043e\u043a\u043d\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u0442\u0441\u044f. <code>WndProc<\/code> \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043e\u043a\u043d\u0430, \u043d\u0430 \u0432\u0441\u0435 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>DefWindowProc<\/code>, \u043a\u0440\u043e\u043c\u0435 \u0434\u0432\u0443\u0445, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043d\u0430\u043c: <code>WM_CLOSE<\/code> \u043d\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435 \u043e\u043a\u043d\u0430 \u0438 <code>WM_USER+1<\/code> \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044f\u0437\u044b\u043a\u0430.<\/p>\n<pre><code class=\"cpp\">LRESULT CALLBACK WndProc(     _In_ HWND hWnd,     _In_ UINT message,     _In_ WPARAM wParam,     _In_ LPARAM lParam ) {     switch (message)     {     case WM_USER + 1:         changeLang(wParam, lParam);         break;     case WM_CLOSE:         PostQuitMessage(0);     default:         return DefWindowProc(hWnd, message, wParam, lParam);     }     return 0; }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0437\u0430 \u0445\u0443\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/api\/processthreadsapi\/nf-processthreadsapi-createprocessw\" rel=\"noopener noreferrer nofollow\">CreateProcess<\/a>:<\/p>\n<pre><code class=\"cpp\">STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory(&amp;si, sizeof(si)); si.cb <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-329525","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/329525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=329525"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/329525\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=329525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=329525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=329525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}