Step.1 取得ListBox的句柄
//参考WindowFromPoint(),FindWindow(),Mouse.CursorPosStep.2 利用消息取得列表
//参考
procedure TForm1.Button1Click(Sender: TObject);
var
  vBuffer: array[0..255] of Char;
  I: Integer;
  S: string;
  vCount: Integer;
begin
  S := '';
  vCount := SendMessage(ListBox1.Handle, LB_GETCOUNT, 0, 0);
  for I := 0 to vCount - 1 do begin
    SendMessage(ListBox1.Handle, LB_GETTEXT, I, Integer(@vBuffer));
    S := S + vBuffer + #13#10;
  end;
  ShowMessage(S);
end;//我就不提供完成的代码,相信你可以组织

解决方案 »

  1.   

    1. 用WindowFromPoint提取ListBox句柄
    2. 用LB_XXXX消息与之通讯即可
      

  2.   

    外部程序是自已人编的吗?如果是,可以让他用listbox.items.savetofile('c:\tem.txt');
    然后你再读这个文件即可。
    如果不是自已人编的我也帮不了你了。
      

  3.   

    var
    hwnd:THandle;
    pos:TPoint;
    i,Cnt:integer;
    Buffer: array[0..255] of Char;
    txt:string;
    begin
    GetCursorPos(pos);
    hWnd:=WindowFromPoint(pos);//获取当前鼠标位置的窗口句柄
    cnt:=sendmessage(hwnd,LB_GETCOUNT,0,0);
    for i := 0 to cnt-1 do
    begin
    sendmessage(hwnd,LB_GETTEXT,i,longint(@Buffer));
    txt:=txt + buffer + #13#10;
    end;
    ShowMessage(txt);
    end;
      

  4.   

    var
    hwnd:THandle;
    pos:TPoint;
    i,Cnt:integer;
    Buffer: array[0..255] of Char;
    txt:string;
    begin
    GetCursorPos(pos);
    hWnd:=WindowFromPoint(pos);//获取当前鼠标位置的窗口句柄
    cnt:=sendmessage(hwnd,LB_GETCOUNT,0,0);
    for i := 0 to cnt-1 do
    begin
    sendmessage(hwnd,LB_GETTEXT,i,longint(@Buffer));
    txt:=txt + buffer + #13#10;
    end;
    ShowMessage(txt);
    end;