procedure TForm1.Button1Click(Sender: TObject);<br>var<br> Count : Integer;<br> H : Integer;<br> I : Integer;<br> Len : Integer;<br> str : string;<br>begin<br> H := StrToInt(Edit1.Text);//listbox的句柄<br> Count := SendMessage(H,LB_GETCOUNT,0,0);<br> for I := 0 to Count-1 do<br> begin<br> Len := SendMessage(H,LB_GETTEXTLEN,I,0);<br> SetLength(str,Len);<br> SendMessage(H,LB_GETTEXT,I,Integer(PChar(str)));<br> ListBox1.Items.Add(str);<br> end;<br>end;