{"id":3244,"date":"2015-12-11T10:06:10","date_gmt":"2015-12-11T02:06:10","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=3244"},"modified":"2015-12-11T10:06:10","modified_gmt":"2015-12-11T02:06:10","slug":"%e6%95%99%e7%a8%8b%e6%9e%9a%e4%b8%be%e6%8c%87%e5%ae%9a%e8%bf%9b%e7%a8%8b%e7%9a%84%e6%89%80%e6%9c%89%e7%aa%97%e5%8f%a3","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=3244","title":{"rendered":"[\u6559\u7a0b]\u679a\u4e3e\u6307\u5b9a\u8fdb\u7a0b\u7684\u6240\u6709\u7a97\u53e3"},"content":{"rendered":"<p>\u5b9e\u9645\u4e0a\uff0c\u8fd9\u4e2a\u7684\u6838\u5fc3\u662f\u7528\u4e8e\u4e00\u4e2a GetWindowThreadProcess \u7684 API \u51fd\u6570\uff0c\u901a\u8fc7\u5b83\u53ef\u4ee5\u786e\u5b9a\u6307\u5b9a\u7684\u7a97\u53e3\u6240\u96b6\u5c5e\u7684\u8fdb\u7a0b\u3002\u7136\u540e\uff0c\u7ed3\u5408 EnumWindows \u5c31\u53ef\u4ee5\u5b8c\u6210\u8fd9\u4e00\u64cd\u4f5c\u4e86\u3002\u5047\u8bbe\u6211\u4eec\u5c06\u6240\u6709\u7684\u7a97\u53e3\u53e5\u67c4\u5230\u4e00\u4e2a TList \u4e2d\uff0c\u6211\u4eec\u5927\u6982\u7684\u4ee3\u7801\u903b\u8f91\u5982\u4e0b\uff1a<\/p>\n<pre class=\"lang:delphi decode:true\">function DoEnumProcessWnd(AWnd: HWND; AParam: LPARAM): Boolean; stdcall;\r\nvar\r\n  AId: Cardinal;\r\n  AList:TList;\r\nbegin\r\n  Result := true;\r\n  GetWindowThreadProcessId(AWnd, AId);\r\n  if AId = PCardinal(AParam)^ then\r\n  begin\r\n    AList:=PPointer(AParam+SizeOf(Pointer));\r\n    AList.Add(Pointer(AWnd);\r\n  end;\r\nend;\r\n\r\nfunction EnumProcessWindows(AProcessId:Cardinal;AList:TList):Integer;\r\nvar\r\n  AParam: array [0 .. 1] of Pointer;\r\nbegin\r\n  AParam[0] := Pointer(AProcessId);\r\n  AParam[1] := AList;\r\n  EnumWindows(@DoEnumProcessWnd, LPARAM(@AParam[0]));\r\n  Result := AList.Count;\r\nend;<\/pre>\n<p>\u6ce8\u610f\u4e00\u70b9\uff0c\u4e0a\u9762\u7684\u4ee3\u7801\u672a\u7ecf\u6d4b\u8bd5\uff0c\u53ea\u662f\u63cf\u8ff0\u4e00\u4e2a\u5927\u6982\u7684\u903b\u8f91\uff0c\u6709\u95ee\u9898\u8bf7\u81ea\u884c\u8c03\u8bd5\uff0c\u601d\u8def\u5c31\u662f\u8fd9\u6837\u5b50\uff0c\u5177\u4f53\u7684\u4ee3\u7801\u4ec5\u4f9b\u53c2\u8003\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b9e\u9645\u4e0a\uff0c\u8fd9\u4e2a\u7684\u6838\u5fc3\u662f\u7528\u4e8e\u4e00\u4e2a GetWi [&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":[8,21],"tags":[83,236,393],"class_list":["post-3244","post","type-post","status-publish","format-standard","hentry","category-delphi","category-misc","tag-83","tag-236","tag-393"],"views":5688,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/3244","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=3244"}],"version-history":[{"count":1,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/3244\/revisions"}],"predecessor-version":[{"id":3245,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/3244\/revisions\/3245"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}