{"id":78,"date":"2008-10-05T15:28:00","date_gmt":"2008-10-05T07:28:00","guid":{"rendered":""},"modified":"2013-11-18T21:47:14","modified_gmt":"2013-11-18T13:47:14","slug":"delphi%e4%b8%ad%e5%ae%9e%e7%8e%b0%e6%96%87%e4%bb%b6%e6%8b%96%e6%94%be","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/78.html","title":{"rendered":"Delphi\u4e2d\u5b9e\u73b0\u6587\u4ef6\u62d6\u653e"},"content":{"rendered":"<p>\u9996\u5148\u5728uses\u4e2d\u52a0\u5165ShellAPI<\/p>\n<p>\u518d\u5728\u7a97\u4f53 TForm1.Create\u4e8b\u4ef6\u4e2d\u52a0\u5165\u4ee3\u7801\uff1a<\/p>\n<pre class=\"brush: delphi; title: ; notranslate\" title=\"\">\r\nDragAcceptFiles(self.Handle,true);\/\/\u8bbe\u5b9a\u63a5\u53d7\u62d6\u52a8\u4e8b\u4ef6\u7684\u53e5\u67c4\u4e3a\u672c\u7a97\u53e3\r\n<\/pre>\n<p>\u518d\u5728TForm1\u7684Public\u4e2d\u5199\uff1a<\/p>\n<pre class=\"brush: delphi; title: ; notranslate\" title=\"\">\r\nProcedure DragFiles(var Msg:TMessage);Message WM_DROPFILES;\/\/\u54cd\u5e94\u6587\u4ef6\u62d6\u52a8\u4e8b\u4ef6\r\n<\/pre>\n<p>\u518d\u5199\u4e0a TForm1.DragFiles\u8fc7\u7a0b\u7684\u4ee3\u7801:<\/p>\n<pre class=\"brush: delphi; title: ; notranslate\" title=\"\">\r\nprocedure TForm1.DragFiles(var msg:TMessage);\r\nvar p:array&#x5B;0..254] of char;\r\n    i:word;\r\nbegin\r\ninherited;\r\n\/\/ i:=DragQueryFile(Msg.WParam,$FFFFFFFF,nil,0);\/\/\u8fd9\u4e00\u53e5\u7ed3\u679ci=\u62d6\u653e\u6587\u4ef6\u7684\u603b\u4e2a\u6570\r\n\/\/ for i:=0 to i-1 do\r\n\/\/ begin\r\n   DragQueryFile(Msg.WParam,0,p,255);\/\/\u5c06\u62d6\u653e\u7684\u7b2ci\u4e2a\u6587\u4ef6\u7684\u6587\u4ef6\u8def\u5f84\u62f7\u5230P\u4e2d,\u8fd9\u91cc\u6539i\u4e3a0\uff0c\u5c31\u662f\u53ea\u7b97\u7b2c\u4e00\u4e2a\u6587\u4ef6\u7684\r\n   Edit1.Text:=StrPas(p);\r\n\/\/end;\r\nend;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\u5728uses\u4e2d\u52a0\u5165ShellAPI \u518d\u5728\u7a97\u4f53 TForm1.Create\u4e8b\u4ef6\u4e2d\u52a0\u5165\u4ee3\u7801\uff1a DragAccep [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=78"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":4812,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/78\/revisions\/4812"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}