读取外部程序SysListView32 的代码,过不去了,实在搞不定,求高手,
卡在这里了,Count:=SendMessage(list2, LVM_GETITEMCOUNT, 0, 0);在代码红色处,请高人指教以下是代码
#####################
unit moli;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
h,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10:HWND;
begin
h:= FindWindow(nil,'交易远程系统');
h1:=FindWindowEx(h,0,nil,nil);//第一级
h2:=FindWindowEx(h1,0,nil,nil);//第二级
h3:=GetWindow(h2,GW_HWNDNEXT);
h4:=FindWindowEx(h3,0,nil,nil);//合约
h5:=GetWindow(h4,GW_HWNDNEXT);//客户号
h6:=GetWindow(h5,GW_HWNDNEXT);//买卖
h7:=GetWindow(h6,GW_HWNDNEXT);//价格
h8:=GetWindow(h7,GW_HWNDNEXT);//数量
h9:=GetWindow(h8,GW_HWNDNEXT);//开平
h10:=GetWindow(h9,GW_HWNDNEXT);//下单按纽
sendmessage(h4,WM_SETTEXT,255,Integer(PChar('AG(T+D)')));
sendmessage(h5,WM_SETTEXT,255,Integer(PChar('1275')));
sendmessage(h6,WM_SETTEXT,255,Integer(PChar('0 买')));
sendmessage(h7,WM_SETTEXT,255,Integer(PChar('7110')));
sendmessage(h8,WM_SETTEXT,255,Integer(PChar('8 ')));
sendmessage(h9,WM_SETTEXT,255,Integer(PChar('0 开仓')));
PostMessage(h10,WM_LBUTTONDOWN,0,0);
PostMessage(h10,WM_LBUTTONUP,0,0);
//ShowMessage( IntToStr(h8));
end;
procedure TForm1.Button2Click(Sender: TObject);
var
list,list1,list2:hwnd;
Count: Integer;
begin
list:= FindWindow(nil,'自用行情');
list1:=FindWindowEx(list,0,nil,nil);
list2:=FindWindowEx(list1, 0, 'SysHeader32', nil);
Count:=SendMessage(list2, LVM_GETITEMCOUNT, 0, 0);
showmessage(inttostr(count));
end;
end.
##############################################
[ 本帖最后由 zouyifeng 于 2012-10-1 10:27 编辑 ]