{"id":964,"date":"2010-03-16T23:05:00","date_gmt":"2010-03-16T03:05:00","guid":{"rendered":""},"modified":"2013-11-17T16:47:36","modified_gmt":"2013-11-17T08:47:36","slug":"delphi%e7%aa%97%e5%8f%a3%e9%9a%8f%e6%9c%ba%e7%b1%bb%e5%90%8d","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/964.html","title":{"rendered":"Delphi\u7a97\u53e3\u968f\u673a\u7c7b\u540d"},"content":{"rendered":"<pre class=\"brush: delphi; title: ; notranslate\" title=\"\">\r\nunit Unit1;\r\n\r\ninterface\r\n\r\nuses\r\nWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,\r\nDialogs, StdCtrls;\r\n\r\ntype\r\nTForm1 = class(TForm)\r\nButton1: TButton;\r\nprocedure Button1Click(Sender: TObject);\r\nprocedure FormShow(Sender: TObject);\r\nprivate\r\nprocedure CreateParams(var Parames:TCreateParams);override;\r\nFunction Randstring():string;\r\npublic\r\n{ Public declarations }\r\nend;\r\n\r\nvar\r\nForm1: TForm1;\r\n\r\nimplementation\r\n\r\n{$R *.dfm}\r\n\r\nFunction tform1.Randstring():string;\r\nvar\r\ni,t,n:Integer;\r\nc,s:string;\r\nbegin\r\nrepeat\r\nrandomize();\r\nn:=Random(16);\r\nuntil (n&gt;=6) and (n&lt;=16) ;\r\nfor i:=0 to n do\r\nbegin\r\nif i=0 then t:=Random(25)+10 else t:=Random(35);\r\ncase t of\r\n0 :c:='0';\r\n1 :c:='1';\r\n2 :c:='2';\r\n3 :c:='3';\r\n4 :c:='4';\r\n5 :c:='5';\r\n6 :c:='6';\r\n7 :c:='7';\r\n8 :c:='8';\r\n9 :c:='9';\r\n10:c:='a';\r\n11:c:='b';\r\n12:c:='c';\r\n13:c:='d';\r\n14:c:='e';\r\n15:c:='f';\r\n16:c:='g';\r\n17:c:='h';\r\n18:c:='i';\r\n19:c:='j';\r\n20:c:='k';\r\n21:c:='l';\r\n22:c:='m';\r\n23:c:='n';\r\n24:c:='o';\r\n25:c:='p';\r\n26:c:='q';\r\n27:c:='r';\r\n28:c:='s';\r\n29:c:='t';\r\n30:c:='u';\r\n31:c:='v';\r\n32:c:='w';\r\n33:c:='x';\r\n34:c:='y';\r\n35:c:='z';\r\nend;\r\ns:=s+c;\r\nend;\r\nResult:=s;\r\n\r\nend;\r\n\r\nprocedure TForm1.CreateParams(var Parames: TCreateParams);\r\nvar\r\nt:string;\r\ni:Integer;\r\nbegin\r\ninherited CreateParams(Parames);\r\nt:= Randstring() ;\r\nfor i:=1 to Length(t) do\r\nbegin\r\nParames.WinClassName:=t;\r\nend;\r\n\r\nend;\r\n\r\nprocedure TForm1.Button1Click(Sender: TObject);\r\n\r\nvar\r\nName:array&#x5B;0..MAXBYTE] of char;\r\nbegin\r\nGetClassName(Handle,Name,255);\r\nShowMessage(Name);\r\nend;\r\n\r\nprocedure TForm1.FormShow(Sender: TObject);\r\nbegin\r\nform1.Caption:=Randstring();\r\nend;\r\n\r\nend.\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>unit Unit1; interface uses Windows, Messages, SysUtils, [&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-964","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/964","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=964"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/964\/revisions"}],"predecessor-version":[{"id":4703,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/964\/revisions\/4703"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}