{"id":270042,"date":"2015-12-10T12:06:02","date_gmt":"2015-12-10T09:06:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=270042"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=270042","title":{"rendered":"\u041d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (Add-In\u2019\u0430) \u043d\u0430 C#"},"content":{"rendered":"<p>       \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Add-In&#8217;a \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0449\u0443\u044e \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0422\u0438\u043f\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u0440\u043e\u0441\u0442 \u2013 \u0438\u0437\u0443\u0447\u0430\u0435\u043c API \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041d\u0430 \u0432\u044b\u0431\u043e\u0440 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f\u0437\u044b\u043a\u043e\u0432, \u0421# \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u0438\u0437-\u0437\u0430 \u0435\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u043e\u0434 Windows \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 .Net.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0447\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u043b\u043e \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043d\u0443\u0436\u043d\u0443\u044e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043e\u043a\u043d\u0430 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0435\u0433\u043e \u043b\u0438\u0431\u043e \u043f\u043e\u0432\u0435\u0440\u0445 \u0432\u0441\u0435\u0445 \u043e\u043a\u043e\u043d, \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0435\u0433\u043e \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u043d\u0438\u0439 \u043f\u043b\u0430\u043d \u2014 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430. \u0421 \u043d\u0438\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u0435-\u043a\u0430\u043a \u043c\u0438\u0440\u0438\u0442\u044c\u0441\u044f, \u043d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u0438\u0445 \u043e\u043a\u043e\u043d \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e?<\/p>\n<p>  \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432 \u0441\u0430\u043c\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u0441\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043a\u0430\u043a \u043d\u0430\u0434\u043e \u2014 \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u0432\u0438\u0434\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u043a\u043e\u043d, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043a\u0430\u043a \u0445\u043e\u0447\u0435\u0442, \u0442\u0430\u043a \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0434\u043b\u044f \u0441\u0435\u0431\u044f. \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e API \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043e\u043a\u043e\u043d \u0432 \u0441\u0440\u0435\u0434\u0443, \u043d\u043e \u043a\u0430\u043a \u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \u041d\u043e, \u0435\u0441\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u043d\u0443\u0436\u043d\u043e, \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 Windows \u043b\u0435\u0436\u0438\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0439\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u2013 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (\u043a\u0430\u043a \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u0430\u043a \u0438 \u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b) \u0438 \u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043d\u0430 \u043d\u0438\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435. \u0412\u0441\u044f \u0434\u0430\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u043e\u043a\u043e\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0437\u0430\u043c\u0435\u043d\u0438\u0432 \u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0441\u0432\u043e\u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043a\u043d\u0430. \u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u2013 WinAPI. \u0421\u0432\u044f\u0437\u044c C# (.NET Framework) \u0438 WinAPI \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Platform Invoke \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u2013 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0430 (C#) \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 WinAPI (\u0421).<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0421\u0410\u041f\u0420 Eplan. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u043f\u044b\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0438\u043f\u043e\u0432\u043e\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (\u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043e\u0441\u043d\u043e\u0432\u0430\u043c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/271671\/\">\u0437\u0434\u0435\u0441\u044c<\/a>), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0443\u0442 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u043d\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0435\u0433\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043e\u043a\u043d\u0435 (\u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u043d\u0435\u043c \u043f\u043b\u0430\u043d\u0435) \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446. <\/p>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, main.cs.<\/p>\n<pre><code class=\"cs\">\/\/@file main.cs \/\/@brief \u041a\u043b\u0430\u0441\u0441\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435.  \/\/ @par \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f: \/\/ @$Rev: 1 $.\\n \/\/ @$Author: idimm $.\\n \/\/ @$Date:: 2015-12-03 12:05:13#$.  using System; using System.Windows.Forms;  using Eplan.EplApi.ApplicationFramework; using Eplan.EplApi.Gui; using Eplan.EplApi.DataModel; using Eplan.EplApi.HEServices;  namespace SimpleAddIn     {     public class AddInModule : IEplAddIn         {         public bool OnRegister( ref bool bLoadOnStart )             {             bLoadOnStart = true;             return true;             }          public bool OnUnregister()             {             return true;             }          public bool OnInit()             {             return true;             }          public bool OnInitGui()             {             Eplan.EplApi.Gui.Menu oMenu = new Eplan.EplApi.Gui.Menu();             uint menuID = oMenu.AddMainMenu(                 &quot;eplaner&quot;, Eplan.EplApi.Gui.Menu.MainMenuName.eMainMenuHelp,                 &quot;\u041e\u043a\u043d\u043e \u043f\u043e\u043c\u043e\u0449\u0438&quot;, &quot;showWndAction&quot;,                 &quot;\u041e\u043a\u043d\u043e \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443&quot;, 0 \/*inserts before*\/ );              return true;             }          public bool OnExit()             {             return true;             }         }       public class Action_Test : IEplAction         {         public Action_Test()             {             frm = new System.Windows.Forms.Form();             rtbox = new System.Windows.Forms.RichTextBox();                          rtbox.Dock = System.Windows.Forms.DockStyle.Fill;             rtbox.Location = new System.Drawing.Point( 0, 0 );             frm.Controls.Add( rtbox );                         }                    public bool OnRegister( ref string Name, ref int Ordinal )             {             Name = &quot;showWndAction&quot;;             Ordinal = 20;                          return true;             }          public bool Execute( ActionCallingContext oActionCallingContext )             {             SelectionSet set = new SelectionSet();             Page[] pages = set.OpenedPages;              rtbox.Clear();             foreach ( Page pg in pages )                  {                 rtbox.AppendText( pg.Name + &quot;\\n&quot; );                 }                         frm.ShowDialog();              return true;             }          public void GetActionProperties( ref ActionProperties actionProperties )             {             }          System.Windows.Forms.Form frm;         System.Windows.Forms.RichTextBox rtbox;         }     } <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f (Action Action_Test) \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u043d\u0443\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c \u0444\u043e\u0440\u043c\u0443 \u0432 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0430\u0445 \u043d\u0438\u0436\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/441\/d7f\/410\/441d7f41099d4d94bd129702f25a3ac2.png\"\/> <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/dcf\/438\/74b\/dcf43874b011456db5bfe85f5d975b8e.png\"\/><\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u043e\u043a\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u0435\u0440\u0445 \u0441\u0440\u0435\u0434\u044b Eplan, \u0440\u0430\u0431\u043e\u0442\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u043e\u043a\u043d\u0430. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0435\u0433\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043e\u043a\u043d\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 frm.ShowDialog() \u043d\u0430 frm.Show() \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Execute \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 Action_Test. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u043e\u043a\u043d\u043e\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0441\u0440\u0435\u0434\u043e\u0439. \u041d\u043e \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u043e\u043a\u043d\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043c\u043e\u0434\u0435\u0440\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 Action_Test:<\/p>\n<pre><code class=\"cs\">public class Action_Test : IEplAction         {         public Action_Test()             {             frm = new System.Windows.Forms.Form();             rtbox = new System.Windows.Forms.RichTextBox();                          rtbox.Dock = System.Windows.Forms.DockStyle.Fill;             rtbox.Location = new System.Drawing.Point( 0, 0 );             frm.Controls.Add( rtbox );             frm.FormClosing += FormClosing;             }                   public bool OnRegister( ref string Name, ref int Ordinal )             {             Name = &quot;showWndAction&quot;;             Ordinal = 20;                          return true;             }          private void FormClosing( object sender, FormClosingEventArgs e )             {             e.Cancel = true;             ( sender as System.Windows.Forms.Form ).Hide();              }          public bool Execute( ActionCallingContext oActionCallingContext )             {             SelectionSet set = new SelectionSet();             Page[] pages = set.OpenedPages;              rtbox.Clear();             foreach ( Page pg in pages )                  {                 rtbox.AppendText( pg.Name + &quot;\\n&quot; );                 }                         frm.Show();                          return true;             }          public void GetActionProperties( ref ActionProperties actionProperties )             {             }          System.Windows.Forms.Form frm;         System.Windows.Forms.RichTextBox rtbox;         } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u043e\u043a\u043d\u0430 (\u043c\u0435\u0442\u043e\u0434 FormClosing). \u0422\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043e\u043d\u043e \u043d\u0435 \u0441\u0430\u043c\u043e\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0444\u043e\u0440\u043c\u044b \u0432\u0435\u043b\u0430 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0435 \u043d\u0430 \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0441\u0440\u0435\u0434\u044b, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043a\u0440\u044b\u0432 \u0435\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435. \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u043a\u043d\u0430 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 WinApi. \u041a\u043e\u0434 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0438\u0436\u0435. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043c\u0435\u0442\u043e\u0434\u0430 ShowDlg() \u043a\u043b\u0430\u0441\u0441\u0430 EplanWindowWrapper.<\/p>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, main.cs.<\/p>\n<pre><code class=\"cs\">\/\/@file main.cs \/\/@brief \u041a\u043b\u0430\u0441\u0441\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435.  \/\/ @par \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f: \/\/ @$Rev: 1 $.\\n \/\/ @$Author: idimm $.\\n \/\/ @$Date:: 2015-12-03 12:05:13#$.  using System; using System.Windows.Forms;  using Eplan.EplApi.ApplicationFramework; using Eplan.EplApi.Gui; using Eplan.EplApi.DataModel; using Eplan.EplApi.HEServices;  namespace SimpleAddIn     {     public class AddInModule : IEplAddIn         {         public bool OnRegister( ref bool bLoadOnStart )             {             bLoadOnStart = true;             return true;             }          public bool OnUnregister()             {             return true;             }          public bool OnInit()             {             return true;             }          public bool OnInitGui()             {             Eplan.EplApi.Gui.Menu oMenu = new Eplan.EplApi.Gui.Menu();             uint menuID = oMenu.AddMainMenu(                 &quot;eplaner&quot;, Eplan.EplApi.Gui.Menu.MainMenuName.eMainMenuHelp,                 &quot;\u041e\u043a\u043d\u043e \u043f\u043e\u043c\u043e\u0449\u0438&quot;, &quot;showWndAction&quot;,                 &quot;\u041e\u043a\u043d\u043e \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443&quot;, 0 \/*inserts before*\/ );              return true;             }          public bool OnExit()             {             return true;             }         }       public class Action_Test : IEplAction         {         public Action_Test()             {             rtbox = new System.Windows.Forms.RichTextBox();                         rtbox.Dock = System.Windows.Forms.DockStyle.Fill;             rtbox.Location = new System.Drawing.Point( 0, 0 );             }                  public bool OnRegister( ref string Name, ref int Ordinal )             {             Name = &quot;showWndAction&quot;;             Ordinal = 20;                          return true;             }          private void FormClosing( object sender, FormClosingEventArgs e )             {             e.Cancel = true;             ( sender as System.Windows.Forms.Form ).Hide();              }          public bool Execute( ActionCallingContext oActionCallingContext )             {             if ( eww == null )                 {                                eww = new EplanWindowWrapper( rtbox, new ToolStrip(), &quot;\u0421\u0442\u0440&quot; );                 }              if ( !wasInit )                 {                 SelectionSet set = new SelectionSet();                 Page[] pages = set.OpenedPages;                  rtbox.Clear();                 foreach ( Page pg in pages )                     {                     rtbox.AppendText( pg.Name + &quot;\\n&quot; );                     }                 }             eww.ShowDlg();              return true;             }          public void GetActionProperties( ref ActionProperties actionProperties )             {             }          System.Windows.Forms.RichTextBox rtbox;         EplanWindowWrapper eww;          bool wasInit = false;         }     } <\/code><\/pre>\n<p>  \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c, EplanWindowWrapper.cs.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">\/\/\/@file EplanWindowWrapper.cs \/\/\/@brief \u041a\u043b\u0430\u0441\u0441\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0434\u043b\u044f  \/\/\/\u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043e\u043a\u043e\u043d \u043f\u043e\u0432\u0435\u0440\u0445 \u043e\u043a\u043e\u043d \u0441\u0440\u0435\u0434\u044b Eplan. \/\/\/ \/\/\/ @par \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f: \/\/\/ @$Rev: 1$.\\n \/\/\/ @$Author: idimm$.\\n \/\/\/ @$Date:: 2012-04-07 16:45:35#$. \/\/\/   using System; using System.Windows.Forms; using System.Runtime.InteropServices;  \/\/\/ &lt;summary&gt; \/\/\/ \u041e\u043a\u043d\u043e, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0435\u0435\u0441\u044f \u0432 Eplan'\u0435 \u0438 \u0432\u0435\u0434\u0443\u0449\u0435\u0435 \u0441\u0435\u0431\u044f \u043a\u0430\u043a \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0435 \u0432 \u0441\u0440\u0435\u0434\u0443. \/\/\/ &lt;\/summary&gt; public class EplanWindowWrapper     {     private IntPtr wndHandle = IntPtr.Zero;     \/\/\/\u041d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0435 \u043e\u043a\u043d\u043e.     private IntPtr dialogHandle = IntPtr.Zero;  \/\/\/\u041d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u0434\u0438\u0430\u043b\u043e\u0433.     private IntPtr panelPtr;                    \/\/\/\u041d\u0430\u0439\u0434\u0435\u043d\u043d\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c.                                                        IntPtr oldDialogWndProc = IntPtr.Zero;      \/\/\/\u0421\u0442\u0430\u0440\u0430\u044f \u043e\u043a\u043e\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430.     IntPtr oldPanelProc = IntPtr.Zero;          \/\/\/\u0421\u0442\u0430\u0440\u0430\u044f \u043e\u043a\u043e\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430.     pi.Win32WndProc newWndProc;                 \/\/\/\u041d\u043e\u0432\u0430\u044f \u043e\u043a\u043e\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430.                               Control mainCntrl;          \/\/\/\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435 \u043e\u043a\u043d\u043e.     byte[] newCaption;          \/\/\/\u041d\u043e\u0432\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043e\u043a\u043d\u0430.      string newCaptionStr;      private string windowName;     private int panelDlgItemId;     private int dialogDlgItemId;     private int panelToHideDlgItemId;     private int menuClickId;       \/\/\/ &lt;summary&gt;         \/\/\/ \u041d\u043e\u0432\u0430\u044f \u043e\u043a\u043e\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439      \/\/\/ \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u043d\u0430 Eplan'\u0430.     \/\/\/ &lt;\/summary&gt;     private IntPtr DialogWndProc( IntPtr hWnd, int msg, int wPar, IntPtr lPar )         {         if ( hWnd == panelPtr )             {             switch ( ( pi.WM ) msg )                 {                 case pi.WM.MOVE:                 case pi.WM.SIZE:                     IntPtr dialogPtr = pi.GetParent( mainCntrl.Handle );                      pi.RECT rctDialog;                     pi.RECT rctPanel;                     pi.GetWindowRect( dialogPtr, out rctDialog );                     pi.GetWindowRect( panelPtr, out rctPanel );                      int w = rctDialog.Right - rctDialog.Left;                     int h = rctDialog.Bottom - rctDialog.Top;                      int dx = rctPanel.Left - rctDialog.Left;                     int dy = rctPanel.Top - rctDialog.Top;                     mainCntrl.Location =                         new System.Drawing.Point( dx, dy );                      mainCntrl.Width = w - dx;                     mainCntrl.Height = h - dy;                     break;                 }              return pi.CallWindowProc( oldPanelProc, panelPtr, msg, wPar, lPar );             }          if ( hWnd == dialogHandle )             {             switch ( ( pi.WM ) msg )                 {                 case pi.WM.GETTEXTLENGTH:                     return ( IntPtr ) newCaption.Length;                  case pi.WM.SETTEXT:                     return IntPtr.Zero;                  case pi.WM.DESTROY:                     dialogHandle = IntPtr.Zero;                      pi.SetParent( mainCntrl.Handle, IntPtr.Zero );                     mainCntrl.Hide();                      System.Threading.Thread.Sleep( 1 );                     break;                  case pi.WM.GETTEXT:                     System.Runtime.InteropServices.Marshal.Copy(                         newCaption, 0, lPar, newCaption.Length );                      return ( IntPtr ) newCaption.Length;                 }             }          return pi.CallWindowProc( oldDialogWndProc, hWnd, msg, wPar, lPar );         }      \/\/\/ &lt;summary&gt;     \/\/\/ \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043e\u043a\u043d\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442      \/\/\/ \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0430 \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435.     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;mainCntrl&quot;&gt;     \/\/\/ \u0412\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u043d\u0430 \u0444\u043e\u0440\u043c\u0435.     \/\/\/ &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;caption&quot;&gt;     \/\/\/ \u041d\u043e\u0432\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043e\u043a\u043d\u0430.     \/\/\/ &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;windowName&quot;&gt;     \/\/\/ \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043e\u043a\u043d\u0430 (\u043e\u043a\u043d\u0430-\u043e\u0441\u043d\u043e\u0432\u044b), \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0430 \u043d\u0430      \/\/\/ \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435.     \/\/\/ &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;panelDlgItemId&quot;&gt;     \/\/\/ \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0430\u043d\u0435\u043b\u0438-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u043e\u043a\u043d\u0430-\u043e\u0441\u043d\u043e\u0432\u044b.     \/\/\/ &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;dialogDlgItemId&quot;&gt;     \/\/\/  \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u043a\u043d\u0430-\u043e\u0441\u043d\u043e\u0432\u044b.     \/\/\/ &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;panelToHideDlgItemId&quot;&gt;     \/\/\/ \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0430\u043d\u0435\u043b\u0438 \u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0441\u0440\u0435\u0434\u044b Eplan, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e     \/\/\/ \u0441\u043a\u0440\u044b\u0442\u044c.     \/\/\/ &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;menuClickId&quot;&gt;     \/\/\/ \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0443\u043d\u043a\u0442\u0430 \u043c\u0435\u043d\u044e \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u043a\u043d\u0430-\u043e\u0441\u043d\u043e\u0432\u044b.     \/\/\/ &lt;\/param&gt;     public EplanWindowWrapper( Control mainCntrl,          string caption, string windowName = &quot;\u041f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043b\u0438\u0441\u0442\u0430&quot;,         int panelDlgItemId = 0xE81F, int dialogDlgItemId = 0x3458,         int panelToHideDlgItemId = 0xBC2, int menuClickId = 35506 )         {         this.mainCntrl = mainCntrl;         mainCntrl.Hide();          newCaptionStr = caption;         newCaption = System.Text.Encoding.GetEncoding( 1251 ).GetBytes(             caption + '\\0' );          this.windowName = windowName;         this.panelDlgItemId = panelDlgItemId;         this.dialogDlgItemId = dialogDlgItemId;         this.panelToHideDlgItemId = panelToHideDlgItemId;         this.menuClickId = menuClickId;          newWndProc = DialogWndProc;         }       \/\/\/ &lt;summary&gt;     \/\/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u043e\u0440\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.     \/\/\/     \/\/\/ \u0422\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u043e\u043a\u043d\u043e, \u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c     \/\/\/ \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:     \/\/\/ 1 \u041f\u043e\u0438\u0441\u043a \u043e\u043a\u043d\u0430 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e &quot;\u041f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043b\u0438\u0441\u0442\u0430&quot;, \u043c\u0435\u043d\u044e \u041f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e     \/\/\/ \u043b\u0438\u0441\u0442\u0430 -&gt; \u041d\u0430\u0432\u0438\u0433\u0430\u0442\u043e\u0440).     \/\/\/ 1.1 \u041f\u043e\u0438\u0441\u043a \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f: \u0447\u0435\u0440\u0435\u0437 FindWindowByCaption ,     \/\/\/ \u043f\u043e\u0442\u043e\u043c \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0430\u043d\u0435\u043b\u0438 \u0438 \u0434\u0438\u0430\u043b\u043e\u0433\u0430 DlgItemId (0xE81F - \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c,     \/\/\/ 0x3458 - \u0434\u0438\u0430\u043b\u043e\u0433). \u0415\u0441\u043b\u0438 \u043e\u043a\u043d\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e, \u0442\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a 4, \u0438\u043d\u0430\u0447\u0435 \u043a 1.2.     \/\/\/ 1.2 \u041f\u043e\u0438\u0441\u043a \u0437\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f: \u0447\u0435\u0440\u0435\u0437 GetDlgItem \u0434\u043b\u044f \u0432\u0441\u0435\u0445      \/\/\/ \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0445 \u043e\u043a\u043e\u043d (GetChildWindows) \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Eplan \u043f\u043e DlgItemId      \/\/\/ (0x3458 - \u0434\u0438\u0430\u043b\u043e\u0433).     \/\/\/ \u0415\u0441\u043b\u0438 \u043e\u043a\u043d\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e, \u0442\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a 4, \u0438\u043d\u0430\u0447\u0435 \u043a 2.     \/\/\/ 2 \u0421\u0438\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u043f\u0443\u043d\u043a\u0442\u0430 \u043c\u0435\u043d\u044e (\u041f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043b\u0438\u0441\u0442\u0430 -&gt; \u041d\u0430\u0432\u0438\u0433\u0430\u0442\u043e\u0440)     \/\/\/ \u0434\u043b\u044f \u0435\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.     \/\/\/ 3 \u041f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u043c \u043f\u043e\u0438\u0441\u043a \u043e\u043a\u043d\u0430 (1.1 \u0438 1.2). \u0415\u0441\u043b\u0438 \u043e\u043a\u043d\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u043c     \/\/\/ \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0438\u043d\u0430\u0447\u0435 \u043a 4.     \/\/\/ 4 \u0421\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043f\u0430\u043d\u0435\u043b\u044c \u0441 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f Eplan'\u0430     \/\/\/ (GetDlgItem, 0xBC2 - \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c, ShowWindow).     \/\/\/ 5. \u041f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u043d\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0441\u0432\u043e\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b (SetParent) \u0438 \u043f\u043e\u0434\u0433\u043e\u043d\u044f\u0435\u043c     \/\/\/ \u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u044e.     \/\/\/ 6. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0432\u043e\u044e \u043e\u043a\u043e\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 (\u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432     \/\/\/ \u0441\u0432\u043e\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u043e\u043a\u043d\u0430).     \/\/\/ &lt;\/summary&gt;     public void ShowDlg()         {         if ( mainCntrl.Visible )             {             return;             }          bool isDocked = false;         System.Diagnostics.Process oCurrent =             System.Diagnostics.Process.GetCurrentProcess();          IntPtr res = pi.FindWindowByCaption( IntPtr.Zero, windowName );\/\/1.1         if ( res != IntPtr.Zero )             {             res = pi.GetDlgItem( res, panelDlgItemId );              wndHandle = pi.GetParent( res );             dialogHandle = pi.GetDlgItem( res, dialogDlgItemId );             }         else                                                            \/\/1.2             {             System.Collections.Generic.List&lt;IntPtr&gt; resW =                  pi.GetChildWindows( oCurrent.MainWindowHandle );             foreach ( IntPtr panel in resW )                 {                 dialogHandle = pi.GetDlgItem( panel, dialogDlgItemId );                 if ( dialogHandle != IntPtr.Zero )                     {                     isDocked = true;                     res = dialogHandle;                     break;                     }                 }              if ( res == IntPtr.Zero )                 {                 pi.SendMessage( oCurrent.MainWindowHandle,                     ( uint ) pi.WM.COMMAND, menuClickId, 0 );           \/\/2                  res = pi.FindWindowByCaption( IntPtr.Zero, windowName );\/\/3                  if ( res != IntPtr.Zero )                     {                     res = pi.GetDlgItem( res, panelDlgItemId );                      wndHandle = pi.GetParent( res );                     dialogHandle = pi.GetDlgItem( res, dialogDlgItemId );                     }                 else                     {                     resW = pi.GetChildWindows( oCurrent.MainWindowHandle );                     foreach ( IntPtr panel in resW )                         {                         dialogHandle = pi.GetDlgItem( panel, dialogDlgItemId );                         if ( dialogHandle != IntPtr.Zero )                             {                             isDocked = true;                             break;                             }                         }                      if ( dialogHandle == IntPtr.Zero )                         {                         System.Windows.Forms.MessageBox.Show(                             &quot;\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043e\u043a\u043d\u043e!&quot; );                         return;                         }                     }                 }             }          panelPtr = pi.GetDlgItem( dialogHandle, panelToHideDlgItemId ); \/\/4         if ( panelPtr == IntPtr.Zero )             {             System.Windows.Forms.MessageBox.Show( &quot;\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043a\u0440\u044b\u0442\u044c \u043e\u043a\u043d\u043e!&quot; );             return;             }          pi.ShowWindow( panelPtr, 0 );                          pi.SetParent( mainCntrl.Handle, dialogHandle );                 \/\/5                    mainCntrl.Show();          int dy = 0;         if ( isDocked )             {             dy = 17;                         }          pi.RECT dialogRect;         pi.GetWindowRect( dialogHandle, out dialogRect );                          mainCntrl.Location = new System.Drawing.Point( 0, dy );          int w = dialogRect.Right - dialogRect.Left;         int h = dialogRect.Bottom - dialogRect.Top - dy;          mainCntrl.Width = w;         mainCntrl.Height = h;          oldDialogWndProc = pi.SetWindowLong( dialogHandle, pi.GWL_WNDPROC,             newWndProc );         oldPanelProc = pi.SetWindowLong( panelPtr, pi.GWL_WNDPROC,              newWndProc );          pi.SetWindowText( dialogHandle, newCaptionStr );         pi.SetWindowText( wndHandle, newCaptionStr );         }     }  \/\/\/ &lt;summary&gt; \/\/\/ Platform Invoke functions. \/\/\/ &lt;\/summary&gt; public class pi     {     \/\/\/ &lt;summary&gt;     \/\/\/ Window procedure.     \/\/\/ &lt;\/summary&gt;     public delegate IntPtr Win32WndProc( IntPtr hWnd, int msg, int wParam,         IntPtr lParam );      public const int GWL_WNDPROC = -4;      \/\/\/ &lt;summary&gt;     \/\/\/ Changes an attribute of the specified window. The function also sets     \/\/\/ the 32-bit (long) value at the specified offset into the extra window     \/\/\/ memory.     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;hWnd&quot;&gt;     \/\/\/ A handle to the window and, indirectly, the class to which the window     \/\/\/ belongs.     \/\/\/ &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;nIndex&quot;&gt;The zero-based offset to the value to be set.     \/\/\/ Valid values are in the range zero through the number of bytes of     \/\/\/ extra window memory, minus the size of an integer. To set any other      \/\/\/ value, specify one of the following values: GWL_EXSTYLE,     \/\/\/ GWL_HINSTANCE, GWL_ID, GWL_STYLE, GWL_USERDATA, GWL_WNDPROC      \/\/\/ &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;dwNewLong&quot;&gt;The replacement value.&lt;\/param&gt;     \/\/\/ &lt;returns&gt;     \/\/\/ If the function succeeds, the return value is the previous value of      \/\/\/ the specified 32-bit integer. If the function fails, the return value     \/\/\/ is zero. To get extended error information, call GetLastError.     \/\/\/ &lt;\/returns&gt;     [DllImport( &quot;user32&quot; )]     public static extern IntPtr SetWindowLong( IntPtr hWnd, int nIndex,         Win32WndProc newProc );      \/\/\/ &lt;summary&gt;     \/\/\/ Set window text.     \/\/\/ &lt;\/summary&gt;     [DllImport( &quot;user32.dll&quot;, SetLastError = true, CharSet = CharSet.Auto )]     public static extern bool SetWindowText( IntPtr hwnd, String lpString );      \/\/\/ &lt;summary&gt;     \/\/\/ Find window by Caption only. Note you must pass IntPtr.     \/\/\/ Zero as the first parameter.     \/\/\/ &lt;\/summary&gt;     [DllImport( &quot;user32.dll&quot;, EntryPoint = &quot;FindWindow&quot;, SetLastError = true )]     public static extern System.IntPtr FindWindowByCaption( IntPtr ZeroOnly,          string lpWindowName );      \/\/\/ &lt;summary&gt;     \/\/\/ Windows Messages     \/\/\/ Defined in winuser.h from Windows SDK v6.1     \/\/\/ Documentation pulled from MSDN.     \/\/\/ &lt;\/summary&gt;     public enum WM : uint         {         \/\/\/ &lt;summary&gt;         \/\/\/ The WM_NULL message performs no operation. An application sends         \/\/\/ the WM_NULL message if it wants to post a message that the          \/\/\/ recipient window will ignore.         \/\/\/ &lt;\/summary&gt;         NULL = 0x0000,         \/\/\/ &lt;summary&gt;         \/\/\/ The WM_CREATE message is sent when an application requests that         \/\/\/ a window be created by calling the CreateWindowEx or CreateWindow         \/\/\/ function. (The message is sent before the function returns.)          \/\/\/ The window procedure of the new window receives this message         \/\/\/ after the window is created, but before the window becomes visible.         \/\/\/ &lt;\/summary&gt;         CREATE = 0x0001,         \/\/\/ &lt;summary&gt;         \/\/\/ The WM_DESTROY message is sent when a window is being destroyed.         \/\/\/ It is sent to the window procedure of the window being destroyed         \/\/\/ after the window is removed from the screen.         \/\/\/ This message is sent first to the window being destroyed and then         \/\/\/ to the child windows (if any) as they are destroyed. During the         \/\/\/ processing of the message, it can be assumed that all child         \/\/\/ windows still exist.         \/\/\/ \/\/\/ &lt;\/summary&gt;         DESTROY = 0x0002,         \/\/\/ &lt;summary&gt;         \/\/\/ The WM_MOVE message is sent after a window has been moved.         \/\/\/ &lt;\/summary&gt;         MOVE = 0x0003,         \/\/\/ &lt;summary&gt;         \/\/\/ The WM_SIZE message is sent to a window after its size has changed.         \/\/\/ &lt;\/summary&gt;         SIZE = 0x0005,         \/\/...         \/\/\/ &lt;summary&gt;         \/\/\/ An application sends a WM_SETTEXT message to set the text of a          \/\/\/ window.         \/\/\/ &lt;\/summary&gt;         SETTEXT = 0x000C,         \/\/\/ &lt;summary&gt;         \/\/\/ An application sends a WM_GETTEXT message to copy the text that         \/\/\/ corresponds to a window into a buffer provided by the caller.         \/\/\/ &lt;\/summary&gt;         GETTEXT = 0x000D,         \/\/\/ &lt;summary&gt;         \/\/\/ An application sends a WM_GETTEXTLENGTH message to determine the         \/\/\/ length, in characters, of the text associated with a window.         \/\/\/ &lt;\/summary&gt;         GETTEXTLENGTH = 0x000E,         \/\/...         \/\/\/ &lt;summary&gt;         \/\/\/ The WM_COMMAND message is sent when the user selects a command         \/\/\/ item from a menu, when a control sends a notification message to         \/\/\/ its parent window, or when an accelerator keystroke is translated.         \/\/\/ &lt;\/summary&gt;         COMMAND = 0x0111,         }          \/\/\/ &lt;summary&gt;     \/\/\/ Get window parent.     \/\/\/ &lt;\/summary&gt;     [DllImport( &quot;user32.dll&quot;, ExactSpelling = true, CharSet = CharSet.Auto )]     public static extern IntPtr GetParent( IntPtr hWnd );      \/\/\/ &lt;summary&gt;     \/\/\/ Set window parent.     \/\/\/ &lt;\/summary&gt;     [DllImport( &quot;user32.dll&quot;, SetLastError = true )]     public static extern IntPtr SetParent( IntPtr hWndChild,         IntPtr hWndNewParent );      \/\/\/ &lt;summary&gt;     \/\/\/ Windows rectangle structure.     \/\/\/ &lt;\/summary&gt;     [StructLayout( LayoutKind.Sequential )]     public struct RECT         {         public int Left;        \/\/ x position of upper-left corner         public int Top;         \/\/ y position of upper-left corner         public int Right;       \/\/ x position of lower-right corner         public int Bottom;      \/\/ y position of lower-right corner         }      \/\/\/ &lt;summary&gt;     \/\/\/ Get window rectangle.     \/\/\/ &lt;\/summary&gt;     [DllImport( &quot;user32.dll&quot; )]     [return: MarshalAs( UnmanagedType.Bool )]     public static extern bool GetWindowRect( IntPtr hWnd, out RECT lpRect );      \/\/\/ &lt;summary&gt;     \/\/\/ Calls window procedure.     \/\/\/ &lt;\/summary&gt;     [DllImport( &quot;user32.dll&quot; )]     public static extern IntPtr CallWindowProc( IntPtr lpPrevWndFunc,         IntPtr hWnd, int Msg, int wParam, IntPtr lParam );      \/\/\/ &lt;summary&gt;     \/\/\/ Gets dialog item by its ID.     \/\/\/ &lt;\/summary&gt;     [DllImport( &quot;user32.dll&quot; )]     public static extern IntPtr GetDlgItem( IntPtr hDlg, int nIDDlgItem );      \/\/\/ &lt;summary&gt;     \/\/\/ Delegate for the EnumChildWindows method     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;hWnd&quot;&gt;Window handle&lt;\/param&gt;     \/\/\/ &lt;param name=&quot;parameter&quot;&gt;     \/\/\/ Caller-defined variable; we use it for a pointer to our list     \/\/\/ &lt;\/param&gt;     \/\/\/ &lt;returns&gt;True to continue enumerating, false to bail.&lt;\/returns&gt;     public delegate bool EnumWindowProc( IntPtr hWnd, IntPtr parameter );      \/\/\/ &lt;summary&gt;     \/\/\/ Returns a list of child windows     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;parent&quot;&gt;Parent of the windows to return&lt;\/param&gt;     \/\/\/ &lt;returns&gt;List of child windows&lt;\/returns&gt;     public static System.Collections.Generic.List&lt;IntPtr&gt; GetChildWindows(          IntPtr parent )         {         System.Collections.Generic.List&lt;IntPtr&gt; result =              new System.Collections.Generic.List&lt;IntPtr&gt;();         GCHandle listHandle = GCHandle.Alloc( result );         try             {             EnumWindowProc childProc = new EnumWindowProc( EnumWindow );             EnumChildWindows( parent, childProc, GCHandle.ToIntPtr( listHandle ) );             }         finally             {             if ( listHandle.IsAllocated )                 listHandle.Free();             }         return result;         }      \/\/\/ &lt;summary&gt;     \/\/\/ Callback method to be used when enumerating windows.     \/\/\/ &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;handle&quot;&gt;Handle of the next window&lt;\/param&gt;     \/\/\/ &lt;param name=&quot;pointer&quot;&gt;     \/\/\/ Pointer to a GCHandle that holds a reference to the list to fill     \/\/\/ &lt;\/param&gt;     \/\/\/ &lt;returns&gt;True to continue the enumeration, false to bail&lt;\/returns&gt;     public static bool EnumWindow( IntPtr handle, IntPtr pointer )         {         System.Runtime.InteropServices.GCHandle gch =             System.Runtime.InteropServices.GCHandle.FromIntPtr( pointer );         System.Collections.Generic.List&lt;IntPtr&gt; list =              gch.Target as System.Collections.Generic.List&lt;IntPtr&gt;;         if ( list == null )             {             throw new InvalidCastException(                  &quot;GCHandle Target could not be cast as List&lt;IntPtr&gt;&quot; );             }         list.Add( handle );                  return true;         }      [DllImport( &quot;user32&quot; )]     [return: MarshalAs( UnmanagedType.Bool )]     public static extern bool EnumChildWindows( IntPtr window,          EnumWindowProc callback, IntPtr i );      [DllImport( &quot;user32.dll&quot; )]     public static extern IntPtr SendMessage( IntPtr hWnd, UInt32 Msg,         Int32 wParam, Int32 lParam );      [DllImport( &quot;user32.dll&quot; )]     [return: MarshalAs( UnmanagedType.Bool )]     public static extern bool ShowWindow( IntPtr hWnd, Int32 nCmdShow );     } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 EplanWindowWrapper. \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043e\u043a\u043d\u0430. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 Spy++, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 Visual Studio. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430, \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043e\u0431\u0435\u0440\u0442\u043a\u0438 WinApi \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (Platform Invoke) \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 pi.<\/p>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0438\u0436\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/9b7\/180\/181\/9b7180181e0940bebf988b62fa7030f6.png\"\/> <\/p>\n<p>  \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043a\u043d\u043e \u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0438 \u043b\u044e\u0431\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0441\u0440\u0435\u0434\u044b, \u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0438 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0443 \u043f\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u0441 \u043d\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043b\u044e\u0431\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u0435\u0433\u043e API \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b.       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/272805\/\"> http:\/\/habrahabr.ru\/post\/272805\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Add-In&#8217;a \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0449\u0443\u044e \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0422\u0438\u043f\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u0440\u043e\u0441\u0442 \u2013 \u0438\u0437\u0443\u0447\u0430\u0435\u043c API \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041d\u0430 \u0432\u044b\u0431\u043e\u0440 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f\u0437\u044b\u043a\u043e\u0432, \u0421# \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 \u0438\u0437-\u0437\u0430 \u0435\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043f\u043e\u0434 Windows \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 .Net.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0447\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u043b\u043e \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043d\u0443\u0436\u043d\u0443\u044e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u0440\u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043e\u043a\u043d\u0430 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0435\u0433\u043e \u043b\u0438\u0431\u043e \u043f\u043e\u0432\u0435\u0440\u0445 \u0432\u0441\u0435\u0445 \u043e\u043a\u043e\u043d, \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0435\u0433\u043e \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u043d\u0438\u0439 \u043f\u043b\u0430\u043d \u2014 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430. \u0421 \u043d\u0438\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u0435-\u043a\u0430\u043a \u043c\u0438\u0440\u0438\u0442\u044c\u0441\u044f, \u043d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u0438\u0445 \u043e\u043a\u043e\u043d \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e?<\/p>\n<p>  \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432 \u0441\u0430\u043c\u043e\u0439 \u0441\u0440\u0435\u0434\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u0441\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043a\u0430\u043a \u043d\u0430\u0434\u043e \u2014 \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u0432\u0438\u0434\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u043a\u043e\u043d, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043a\u0430\u043a \u0445\u043e\u0447\u0435\u0442, \u0442\u0430\u043a \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0434\u043b\u044f \u0441\u0435\u0431\u044f. \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e API \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043e\u043a\u043e\u043d \u0432 \u0441\u0440\u0435\u0434\u0443, \u043d\u043e \u043a\u0430\u043a \u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \u041d\u043e, \u0435\u0441\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u043d\u0443\u0436\u043d\u043e, \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c.  <\/p>\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-270042","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/270042","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=270042"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/270042\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=270042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=270042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=270042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}