我要取另一软件的listbox的一行值,怎么取?(10分)

  • 主题发起人 主题发起人 maheyuan
  • 开始时间 开始时间
M

maheyuan

Unregistered / Unconfirmed
GUEST, unregistred user!
我要取另一软件的listbox的一行值,这个软件的listbox中的每行都没有显示全,我想像金山词霸鼠标取词一样把这一行值取出来,怎么做?
 
用鼠标点那个listbox中的item,然后按下Ctrl+C看能不能复制下来
 
取是肯定可以的。<br><br>先要把程序注入到那一进程中,然后发消息LB_GETTEXT &nbsp;<br><br>很麻烦。
 
做钩子<br>截取系统消息
 
我做过取EmailSpider搜索出来的邮件地址的程序,它的数据是放在ListView中的,ListBox应该更简单。<br><br>procedure TForm1.Doit;<br>var<br>&nbsp; handle:THandle; &nbsp;//handle of the ListView<br>&nbsp; wparm:word;<br>&nbsp; lparm:longword;<br>&nbsp; result,i,j : integer;<br>&nbsp; str: array[0..100] of char;<br>&nbsp; p: PChar;<br>begin<br>&nbsp; Handle := 67556; &nbsp;//67556是用Spy++找出目标Listview的Handle<br>&nbsp; wparm := 0;<br>&nbsp; lparm := 0;<br>&nbsp; result := sendmessage(handle, LVM_GETITEMCOUNT, wparm, lparm);<br>&nbsp; self.Label1.Caption := inttostr(result);<br>&nbsp; p := @str;<br>&nbsp; for i := 0 to result - 1 do begin<br>&nbsp; &nbsp;application.ProcessMessages;<br>&nbsp; &nbsp;application.ProcessMessages;<br>&nbsp; &nbsp;SendMessage(handle, LVM_EDITLABEL , i, 0);<br>&nbsp; &nbsp;application.ProcessMessages;<br>&nbsp; &nbsp;application.ProcessMessages;<br>&nbsp; &nbsp;postMessage(SendMessage(handle, LVM_GETEDITCONTROL , 0, 0), WM_COPY , 0, 0);<br>&nbsp; &nbsp;application.ProcessMessages;<br>&nbsp; &nbsp;application.ProcessMessages;<br>&nbsp; &nbsp;memo1.Lines.Add('');<br>&nbsp; &nbsp;memo1.PasteFromClipboard;<br>&nbsp; &nbsp;sleep(100);<br>&nbsp; end;<br><br>end;
 
关键是找出你要的那个listbox的句柄
 
利用剪贴板不错,好办法,我想的太复杂了。
 
多谢大家,分数已分配arhaha 8分,fu_qi_ming 1分,新手101010 1分
 
后退
顶部