T
tyguiping
Unregistered / Unconfirmed
GUEST, unregistred user!
Tsct = record<br> a: array [0..49] of char;<br> b: integer;<br> c: array [0..39] of char;<br> end;<br> PTSct = ^Tsct;<br><br>const<br> c_cutFormat = 'myCutDataFormat';<br>var<br> Form1: TForm1;<br> sct: Tsct;<br> cutFormat: UINT ;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> h: cardinal; {&Egrave;&laquo;&frac34;&Ouml;&Auml;&Uacute;&acute;&aelig;&frac34;&auml;±ú}<br> i,il: Integer; {&Ntilde;&shy;&raquo;·±&auml;&Aacute;&iquest;}<br> s: String; {&Aacute;&Ugrave;&Ecirc;±×&Ouml;·&ucirc;&acute;&reg;±&auml;&Aacute;&iquest;}<br> p: pTSct; {&frac12;á&sup1;&sup1;&Ouml;&cedil;&Otilde;&euml;±&auml;&Aacute;&iquest;&pound;&not;&Oacute;&Atilde;&Agrave;&acute;·&Atilde;&Icirc;&Ecirc;&Ecirc;&yacute;&frac34;&Yacute;&micro;&yen;&Ocirc;&ordf;}<br>begin<br> if cutFormat = 0 then<br> begin<br> showmessage('&frac14;&ocirc;&Ccedil;&ETH;°&aring;&cedil;&ntilde;&Ecirc;&frac12;&acute;í&Icirc;ó');<br> Exit;<br> end;<br> il := sizeof(tsct);<br> h := GlobalAlloc(GMEM_MOVEABLE,il*5); {此处的长度错误,不知为什么,将5改为20就可以正常运行了,上一句取错了吗,应该如何改正}<br> p := GlobalLock(h); {&Egrave;&iexcl;&micro;&Atilde;&Auml;&Uacute;&acute;&aelig;&Ouml;&cedil;&Otilde;&euml;}<br> for i := 0 to 4 do {&Ntilde;&shy;&raquo;·&cedil;&sup3;&Ouml;&micro;}<br> begin<br> p := PTsct(Integer(p) + il*i);<br> s := intToStr(i) + ' ';<br> strcopy(p.a,pchar(s+s+s+s+s+s+s+s+s+s));<br> p.b := i;<br> strcopy(p.c,pchar(s+':'+s));<br> end;<br> GlobalUnlock(h); {&Ecirc;&Iacute;·&Aring;&Egrave;&laquo;&frac34;&Ouml;&Auml;&Uacute;&acute;&aelig;&micro;&Auml;&Euml;&oslash;&para;¨}<br> openclipboard(handle); {&acute;ò&iquest;&ordf;&frac14;&ocirc;&Ccedil;&ETH;°&aring;}<br> EmptyClipboard; {&Ccedil;&aring;&iquest;&Otilde;&Ograve;&Ntilde;&Oacute;&ETH;&Ecirc;&yacute;&frac34;&Yacute;}<br> SetClipBoardData(cutFormat,h); {&frac12;&laquo;&Ecirc;&yacute;&frac34;&Yacute;±&pound;&acute;&aelig;&micro;&frac12;&frac14;&ocirc;&Ccedil;&ETH;°&aring;}<br> CloseClipboard; {&sup1;&Oslash;±&Otilde;&frac14;&ocirc;&Ccedil;&ETH;°&aring;}<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> cutFormat := RegisterClipBoardFormat(c_cutFormat); {×&cent;&sup2;á&frac14;&ocirc;&Ccedil;&ETH;°&aring;&cedil;&ntilde;&Ecirc;&frac12;}<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>var<br> h: cardinal;<br> p: PTsct;<br> i,il: Integer;<br>begin<br> Openclipboard(handle); {&acute;ò&iquest;&ordf;&frac14;&ocirc;&Ccedil;&ETH;°&aring;}<br> if not Isclipboardformatavailable(cutFormat) then {&sup2;&acirc;&Ecirc;&Ocirc;&frac14;&ocirc;&Ccedil;&ETH;°&aring;&Ouml;&ETH;&micro;&Auml;&Ecirc;&yacute;&frac34;&Yacute;&cedil;&ntilde;&Ecirc;&frac12;}<br> begin<br> showmessage('Register format fail');<br> Exit;<br> end;<br> h := GetClipBoardData(cutformat); {&Egrave;&iexcl;&micro;&Atilde;&frac14;&ocirc;&Ccedil;&ETH;°&aring;&Ouml;&ETH;&micro;&Auml;&Ecirc;&yacute;&frac34;&Yacute;&Ouml;&cedil;&Otilde;&euml;}<br> p := GlobalLock(h); {&Egrave;&iexcl;&micro;&Atilde;&Ecirc;&yacute;&frac34;&Yacute;&micro;&yen;&Ocirc;&ordf;&Ouml;&cedil;&Otilde;&euml;}<br> memo1.Lines.Clear;<br> il := sizeof(TSCT);<br> for i := 0 to 4 do<br> begin {&Egrave;&iexcl;&micro;&Uacute;i&cedil;&ouml;&Ecirc;&yacute;&frac34;&Yacute;&micro;&yen;&Ocirc;&ordf;&micro;&Auml;&Auml;&Uacute;&Egrave;&Yacute;}<br> p := PTsct(Integer(p) + il*i  ;<br> memo1.Lines.Add(p.a);<br> memo1.Lines.Add(IntToStr(p.b));<br> memo1.Lines.Add(p.c);<br> memo1.Lines.Add('-----------------------------------');<br> end;<br> GlobalUnlock(h); {&Ecirc;&Iacute;·&Aring;&Egrave;&laquo;&frac34;&Ouml;&Auml;&Uacute;&acute;&aelig;&micro;&Auml;&Euml;&oslash;&para;¨}<br> CloseClipboard; {&sup1;&Oslash;±&Otilde;&frac14;&ocirc;&Ccedil;&ETH;°&aring;}<br>end;