{"id":1090,"date":"2014-10-31T16:47:16","date_gmt":"2014-10-31T08:47:16","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=1090"},"modified":"2014-12-30T23:29:21","modified_gmt":"2014-12-30T15:29:21","slug":"%e5%9c%a8fmx%e4%b8%ad%e5%ae%9e%e7%8e%b0postmessage%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=1090","title":{"rendered":"\u5728FMX\u4e2d\u5b9e\u73b0PostMessage\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>\u9996\u5148\uff0c\u505a\u4e3a\u4e00\u4e2a\u4eceWindows\u4e0b\u8f6c\u8fc7\u6765\u7684\u5f00\u53d1\u4eba\u5458\uff0c\u8bb8\u591a\u65f6\u5019\uff0c\u6211\u4eec\u559c\u6b22\u7528PostMessage\u6765\u89e6\u53d1\u4e00\u4e9b\u5f02\u6b65\u6267\u884c\u7684\u4ee3\u7801\uff0c\u4f46\u9057\u61be\u7684\u662f\uff0cFMX\u505a\u4e3aEMB\u7684\u8de8\u5e73\u53f0\u5e93\u7684\u57fa\u7840\uff0c\u53ea\u63d0\u4f9b\u4e86SendMessage\u65b9\u6cd5\uff0c\u5374\u6ca1\u6709\u63d0\u4f9bPostMessage\u65b9\u6cd5\u3002<br \/>\n\u90a3\u6211\u4eec\u786e\u5b9e\u9700\u8981PostMessage\u600e\u4e48\u529e\uff1f\u6211\u56e0\u4e3a\u7528\u5230\u4e86\uff0c\u6240\u4ee5\u7814\u7a76\u4e86\u4e0b\uff0c\u7f16\u5199\u4e86\u4e00\u4e2afmx.postqueue\u5355\u5143\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7c7b\u4f3c\u7684PostMessage\u65b9\u6cd5\uff0c\u4f9b\u5927\u5bb6\u53c2\u8003\u3002\u6b64\u4ee3\u7801\u53ef\u4ee5\u8fd0\u884c\u5728\u8de8\u5e73\u53f0\u73af\u5883\u4e0b\uff0c\u6240\u4ee5\u4f60\u53ef\u4ee5\u653e\u5fc3\u5728Windows\u3001Andriod\u3001iOS\u3001OSX\u4e2d\u4f7f\u7528\u3002<\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a\u6211\u4e0d\u559c\u6b22\u6d88\u606f\u6620\u5c04\u7684\u65b9\u5f0f\uff0c\u6240\u4ee5\u76f4\u63a5PostMessage\u7684\u5b9a\u4e49\u6211\u6539\u4e86\u4e00\u4e0b\uff0c\u8ba9\u5176\u66f4\u7b80\u5355\u6613\u7528\u3002<\/p>\n<pre class=\"lang:delphi decode:true \">type\r\n  TPostProcedure=procedure (ASender:TObject;AMsgId:Integer;AWParam,ALParam:NativeInt) of object;\r\n  procedure PostMessage(ACallback:TPostProcedure;ASender:TObject;AMsgId:Integer;AWParam,ALParam:NativeInt);\r\n<\/pre>\n<p>\u9996\u5148\u662f\u4e00\u4e2a\u6d88\u606f\u54cd\u5e94\u8fc7\u7a0b\uff0c\u5982\u679c\u4f60\u5c06\u6240\u6709\u7684\u5f02\u6b65\u6d88\u606f\u54cd\u5e94\u8fc7\u7a0b\u90fd\u6295\u5bc4\u5230\u540c\u4e00\u4e2a\u51fd\u6570\uff0c\u90a3\u57fa\u672c\u4e0a\u5c31\u662fWindows\u4e0a\u7684PostMessage\u51fd\u6570\u7684\u7ffb\u7248\u4e86\uff0c\u4f60\u53ea\u80fd\u5728\u56de\u8c03\u51fd\u6570\u4e2d\u6839\u636e\u6d88\u606fID\u6328\u4e2a\u5904\u7406\u4e86\u3002<\/p>\n<p>TPostProcedure\u63d0\u4f9b\u4e86\u56db\u4e2a\u53c2\u6570\uff1a<\/p>\n<p>ASender \u00a0: \u6d88\u606f\u7684\u53d1\u9001\u8005\uff0c\u5982\u679c\u4e0d\u9700\u8981\uff0c\u53ef\u4ee5\u4f20\u9012\u4e3anil\/NULL\u3002<\/p>\n<p>AMsgId : \u6d88\u606fID\uff0c\u4e00\u4e2a\u6574\u6570\u503c\uff0c\u5982\u679c\u4e0d\u9700\u8981\u533a\u5206\uff0c\u76f4\u63a5\u8d4b0\u5c31\u597d\u4e86\u3002<\/p>\n<p>AWParam : \u4e00\u4e2a\u9644\u52a0\u7684\u53c2\u6570\uff0c\u5177\u4f53\u7531\u7a0b\u5e8f\u81ea\u5df1\u51b3\u5b9a\uff0c\u548cWindows\u4e0b\u6d88\u606f\u7684WParam\u53c2\u6570\u4e00\u6837\u3002<\/p>\n<p>ALParam : \u540c\u4e0a<\/p>\n<p>\u63a5\u53e3\u5c31\u662f\u8fd9\u4e48\u4e00\u4e2a\u7b80\u5355\u7684\u5b9a\u4e49\u4e86\uff0c<strong>\u7528\u65f6\u76f4\u63a5\u5728\u540e\u53f0\u7ebf\u7a0b\u6216\u4e3b\u7ebf\u7a0b\u4e2dPostMessage\u5c31\u53ef\u4ee5\uff0c\u8fd9\u4e2a\u51fd\u6570\u662f\u7ebf\u7a0b\u5b89\u5168\u7684\u3002<\/strong><\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a\u6211\u6765\u8be6\u7ec6\u8bf4\u660e\u4e0b\u8fd9\u4e2a\u51fd\u6570\u7684\u5b9e\u73b0\u539f\u7406\u3002<\/p>\n<p>1\u3001\u81ea\u5df1\u5efa\u7acb\u4e00\u4e2a\u5185\u90e8\u5217\u8868\uff0c\u7528\u6765\u5b58\u8d2e\u6295\u5bc4\u6765\u7684\u6d88\u606f\u3002<\/p>\n<p>2\u3001\u6ce8\u518c\u4e00\u4e2a\u7528\u4e8e\u54cd\u5e94TIdleMessage\u6d88\u606f\u7684\u56de\u8c03\u51fd\u6570\uff0c\u5728\u5176\u4e2d\u5904\u7406\u8fd9\u4e9b\u5f02\u6b65\u6d88\u606f\u7684\u54cd\u5e94\u3002<\/p>\n<p>3\u3001\u5728\u6295\u5bc4\u6d88\u606f\u65f6\uff0c\u5c06\u6d88\u606f\u52a0\u5165\u5230\u5185\u90e8\u5217\u8868\uff0c\u7136\u540e\u5982\u679c\u5b9a\u4e49\u4e86WakeMainThread\u51fd\u6570\uff0c\u5c31\u8c03\u7528WakeMainThread\u51fd\u6570\uff0c\u4ece\u800c\u6fc0\u6d3b\u4e3b\u7ebf\u7a0b\u7684\u6d88\u606f\u5faa\u73af\uff0c\u7528\u4e8e\u5904\u7406\u5f02\u6b65\u6d88\u606f\u3002<\/p>\n<p>\u57fa\u672c\u7684\u601d\u8def\u5c31\u662f\u8fd9\u4e2a\u6837\u5b50\uff0c\u800c\u540e\u9762\u5b9e\u9645\u8fd8\u6ce8\u518c\u4e86\u9000\u51fa\u8fc7\u7a0b\uff0c\u7528\u6765\u6e05\u7406\u81ea\u8eab\uff0c\u9632\u6b62\u5185\u5b58\u6cc4\u9732\u3002<\/p>\n<h4>\u3010\u4e0b\u8f7d\u94fe\u63a5\u3011<\/h4>\n<p><a href=\"http:\/\/pan.baidu.com\/s\/1hqGINKK\">\u767e\u5ea6\u7f51\u76d8<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\uff0c\u505a\u4e3a\u4e00\u4e2a\u4eceWindows\u4e0b\u8f6c\u8fc7\u6765\u7684 [&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":[145,69,8,21],"tags":[136,149,150,151,148],"class_list":["post-1090","post","type-post","status-publish","format-standard","hentry","category-android","category-c-builder","category-delphi","category-misc","tag-andriod","tag-fmx","tag-ios","tag-macos","tag-postmessage"],"views":9537,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1090","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=1090"}],"version-history":[{"count":4,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1090\/revisions"}],"predecessor-version":[{"id":1636,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1090\/revisions\/1636"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1090"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1090"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1090"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}