枚举子窗口,进行不下去了
项目需要,调用并控制第三方的一个程序。我已经用FindWindow查找到程序运行后的窗口,获得了句柄,并准备继续枚举窗口里面的子窗口,代码如下:
procedure TForm1.Button3Click(Sender: TObject);
var
FindWindowThread : TFindWindowThread;
FEditWindow,h : integer;
begin
FindWindowThread := TFindWindowThread.Create(false,FDesktop);
try
FindWindowThread.WaitFor;
FMainWindowHandle := FindWindowThread.WindowHandle;
finally
FindWindowThread.Free;
end;
if FMainWindowHandle = 0 then begin
MessageBox(Application.Handle,'Error when init voice (6).',PChar(Application.Title),MB_ICONWARNING);
exit;
end;
//
ShowMessage(IntToHex(FMainWindowHandle,2));
EnumChildWindows(FMainWindowHandle,@EnumChildWndProc,0);
h := FindWindowEx(FMainWindowHandle,0,nil,PChar('IVA Configuration Menubar.vi'));
Memo1.Lines.Add('**********这是菜单栏目**********');
EnumChildWindows(h,@EnumChildWndProc,0);
//ShowMessage(IntToHex(h,2));
h := FindWindowEx(FMainWindowHandle,0,nil,PChar('IVA Product Inspection View 1.vi'));
Memo1.Lines.Add('**********这是显示流程那个栏目**********');
EnumChildWindows(h,@EnumChildWndProc,0);
//ShowMessage(IntToHex(h,2));
h := FindWindowEx(FMainWindowHandle,0,nil,PChar('IVA Configuration Tools Palette.vi'));
Memo1.Lines.Add('**********这是制作流程那个栏目**********');
EnumChildWindows(h,@EnumChildWndProc,0);
//ShowMessage(IntToHex(h,2));
h := FindWindowEx(FMainWindowHandle,0,nil,PChar('IVA Product Inspection Functions.vi'));
Memo1.Lines.Add('**********这是流程那个栏目**********'); //
EnumChildWindows(h,@EnumChildWndProc,0);
//ShowMessage(IntToHex(h,2));
Memo1.Lines.SaveToFile('abc.txt');
end;
我能确定下面4个是窗口中的部分子窗口(sky++查看到的),执行的结果如下:
$$ IMAQ Display View
$$ ScrollBar
$$ ScrollBar
$$ ScrollBar
$$ AfxWnd70s
IVA Product Inspection View 1.vi $$ LVDChild
IVA Thumbnail Browser.vi $$ LVDChild
IVA Configuration Tools Palette.vi $$ LVDChild
IVA Configuration Menubar.vi $$ LVDChild
IVA Product Inspection Functions.vi $$ LVDChild
**********这是菜单栏目**********
**********这是显示流程那个栏目**********
**********这是制作流程那个栏目**********
**********这是流程那个栏目**********
以上可以看到,我也找到了这4个子窗口的句柄,但继续找这4个子窗口中的子窗口的时候,却什么都找不到了。
经网上查询,LVDChild是非标准的windows窗口,请问我该如何继续进行下去?
找不到控件的句柄,意味着我无法用SendMessage发送控制消息。