{"id":2767,"date":"2015-07-31T14:45:24","date_gmt":"2015-07-31T06:45:24","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=2767"},"modified":"2015-07-31T14:54:57","modified_gmt":"2015-07-31T06:54:57","slug":"qplugins-%e4%bd%bf%e7%94%a8-qplugins-%e7%9a%84%e9%80%9a%e7%9f%a5%e6%9c%ba%e5%88%b6","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=2767","title":{"rendered":"[QPlugins] \u4f7f\u7528 QPlugins \u7684\u901a\u77e5\u673a\u5236"},"content":{"rendered":"<p>\u9996\u5148\uff0c\u6211\u4eec\u8981\u77e5\u9053 QPlugins \u7684\u901a\u77e5\u673a\u5236\u4f7f\u7528\u4e86\u8ba2\u9605\u53d1\u5e03\u6a21\u5f0f\u3002\u4e00\u4e2a\u901a\u77e5\u6216\u53eb\u4e3b\u9898\u6709\u4e24\u4e2a\u91cd\u8981\u7684\u5c5e\u6027\uff1a<\/p>\n<ul>\n<li>\u540d\u79f0\uff08Name\uff09<br \/>\n\u540d\u79f0\u662f\u901a\u77e5\u7c7b\u578b\u7684\u540d\u5b57\uff0c\u5fc5\u9700\u5728\u6574\u4e2a\u63d2\u4ef6\u7cfb\u7edf\u4e2d\u4fdd\u8bc1\u552f\u4e00\uff0c\u540c\u540d\u7684\u88ab\u8ba4\u4e3a\u662f\u4e00\u4e2a\u7c7b\u578b\u7684\u901a\u77e5\u3002\u5f53\u8de8\u8fdb\u7a0b\u901a\u4fe1\u65f6\uff0c\u662f\u9760\u540d\u79f0\u800c\u4e0d\u662f ID \u6765\u552f\u4e00\u533a\u5206\u901a\u77e5\u3002<\/li>\n<li>\u7f16\u53f7\uff08ID\uff09<br \/>\n\u4e00\u4e2a\u8fdb\u7a0b\u552f\u4e00\u7684\u7f16\u53f7\uff08\u4e3a\u4ec0\u4e48\u662f\u8fdb\u7a0b\u552f\u4e00\uff0c\u8fd9\u4e2a\u95ee\u9898\u597d\u9ad8\u96be\uff0c\u6240\u4ee5\u4e0d\u77e5\u9053\u5982\u4f55\u56de\u7b54\uff09\uff0c\u8fd9\u4e2aID\u662f\u4e00\u4e2a\u6574\u6570\uff0c\u4ece0\u5f00\u59cb\uff0c\u5728\u4f60\u8c03\u7528 IdByName \u83b7\u53d6 ID \u65f6\u751f\u6210\uff0c\u8fd9\u4e2a ID \u65e0\u8bba\u6ce8\u518c\u591a\u5c11\u6b21\uff0c\u90fd\u4f1a\u8fd4\u56de\u540c\u4e00\u4e2a\u503c\u3002\u4f46\u662f\uff0c\u8fd9\u4e2a\u503c\u4e0d\u8de8\u8fdb\u7a0b\uff0c\u6240\u4ee5\u4e0d\u80fd\u7528\u4e8e\u5728\u7f51\u7edc\u6216\u591a\u8fdb\u7a0b\u95f4\u5e7f\u64ad\u901a\u77e5\u3002<\/li>\n<\/ul>\n<p>\u597d\u4e86\uff0c\u65e2\u7136\u662f\u8ba2\u9605\u53d1\u5e03\u6a21\u5f0f\uff0c\u90a3\u4e48\uff0c\u6211\u4eec\u5c31\u53ea\u9700\u8981\u5728\u5bf9\u901a\u77e5\u611f\u5174\u8da3\u7684\u5730\u65b9\uff0c\u8c03\u7528\u8ba2\u9605\u7684\u63a5\u53e3\u6765\u8ba2\u9605\u901a\u77e5\u3002\u6211\u4eec\u5206\u6210\u4e24\u4e2a\u90e8\u5206\u6765\u8bf4\u8fd9\u4e0b\u4e8b\u3002<\/p>\n<p>1\u3001\u8ba2\u9605\u8005\u9700\u8981\u5b9e\u73b0 IQNotify \u63a5\u53e3\uff0c\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff1a<\/p>\n<pre class=\"lang:delphi decode:true\">type\r\n   TMyHandler=class(IQNotify)\r\n     procedure Notify(const AId: Cardinal; AParams: IQParams;\r\n      var AFireNext: Boolean); stdcall;\r\n   end;\r\n<\/pre>\n<p>\u8fd9\u91cc\u6709\u4e09\u4e2a\u53c2\u6570\uff0c\u54b1\u4eec\u6765\u7b80\u5355\u89e3\u91ca\u4e00\u4e0b\uff1a<\/p>\n<ul>\n<li>AId\uff1a\u8ba2\u9605\u8005\u6536\u5230\u7684\u901a\u77e5\u7f16\u53f7<\/li>\n<li>AParams \uff1a \u8ba2\u9605\u8005\u6536\u5230\u7684\u901a\u77e5\u9644\u52a0\u7684\u53c2\u6570\u4fe1\u606f\uff0c\u5177\u4f53\u5185\u5bb9\u7531\u901a\u77e5\u7684\u53d1\u5e03\u8005\u51b3\u5b9a<\/li>\n<li>AFireNext\uff1a\u662f\u5426\u5141\u8bb8\u901a\u77e5\u7ba1\u7406\u5668\u53d1\u9001\u901a\u77e5\u7ed9\u4e0b\u4e00\u4e2a\u8ba2\u9605\u8005<\/li>\n<\/ul>\n<p>\u7136\u540e\u4f60\u521b\u5efa\u4e00\u4e2a TMyHandler \u7684\u5b9e\u4f8b\uff0c\u7528\u6765\u63a5\u6536\u901a\u77e5\uff0c\u5927\u6982\u610f\u601d\u662f\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">var\r\n  AMgr:IQNotifyManager;\r\nbegin\r\nAMgr:=PluginsManager as IQNotifyManager;\r\nFNotifyId:=AMgr.IdByName('\u901a\u77e5\u540d\u79f0');\r\nAMgr.Subscribe(FNotifyId,TMyHandler.Create);\r\n...<\/pre>\n<p>\u5982\u679c\u662f DLL \u6216 BPL \u4e2d\u7684\u63d2\u4ef6\uff0c\u4f60\u9700\u8981\u5728\u6a21\u5757\u5378\u8f7d\u65f6\uff0c\u8c03\u7528 IQNotifyManager.Unsubscribe \u6765\u53d6\u6d88\u8ba2\u9605\uff0c\u5426\u5219\u53ef\u80fd\u4f1a\u51fa AV \u9519\u8bef\u3002\u8fd9\u91cc\u5c31\u4e0d\u5728\u7f00\u8ff0\u3002<\/p>\n<p>2\u3001\u53d1\u5e03\u8005<\/p>\n<p>\u597d\u5427\uff0c\u6211\u627f\u8ba4\u53d1\u5e03\u8005\u6700\u4e0d\u8d1f\u8d23\u4efb\uff0c\u5b83\u4e0d\u9700\u8981\u5904\u7406\u901a\u77e5\u53d1\u5e03\u540e\u7684\u7ed3\u679c\uff0c\u5b83\u53ea\u662f\u8d1f\u8d23\u53d1\u901a\u77e5\u3002\u540c\u6837\u7684\uff0c\u7b2c\u4e00\u6b65\uff0c\u901a\u8fc7 IdByName \u6765\u83b7\u53d6\u6307\u5b9a\u7684\u901a\u77e5 ID\uff0c\u7136\u540e\u53ea\u9700\u8981\u8c03\u7528 IQNotifyManager.Send \u6216 Post \u65b9\u6cd5\u6765\u53d1\u5e03\u901a\u77e5\uff0c\u4e8c\u8005\u7684\u533a\u522b\u5c31\u8c61 SendMessage \u548c PostMessage \u4e00\u6837\u3002<\/p>\n<pre class=\"lang:delphi decode:true \">(PluginsManager as IQNotifyManager).Send(FNotifyId,\u901a\u77e5\u7684\u53c2\u6570);<\/pre>\n<p>OK\uff0c\u53d1\u5e03\u8005\u4e0d\u9700\u8981\u4efb\u4f55\u6e05\u7406\u5de5\u5177\uff0c\u56e0\u4e3a\u53d1\u5e03\u5b8c\u5c31\u6ca1\u5b83\u4ec0\u4e48\u4e8b\u4e86\u3002\u6211\u4eec\u770b\u4e00\u4e2a\u4f8b\u5b50\u7684\u6267\u884c\u6548\u679c\uff1a<\/p>\n<p><a href=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/07\/notify.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2768\" src=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2015\/07\/notify.gif\" alt=\"notify\" width=\"1019\" height=\"401\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\uff0c\u6211\u4eec\u8981\u77e5\u9053 QPlugins \u7684\u901a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[69,8,9,50],"tags":[],"class_list":["post-2767","post","type-post","status-publish","format-standard","hentry","category-c-builder","category-delphi","category-qdac","category-qplugin"],"views":5331,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2767","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2767"}],"version-history":[{"count":3,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2767\/revisions"}],"predecessor-version":[{"id":2772,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2767\/revisions\/2772"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}