赞
踩
Win7父窗口类名是 WorkerW,但是WorkerW有多个
function Find_Window(XParent: HWND; XFromIndex: Integer; const XClassNames: array of string): HWND;
var
LName: string;
LChild: HWND;
begin
Result := XParent;
if (XFromIndex < Low(XClassNames)) or (XFromIndex > High(XClassNames)) then
begin
Exit;
end;
LName := XClassNames[XFromIndex];
LChild := 0;
while True do
begin
LChild := FindWindowEx(XParent, LChild, PChar(LName), nil);
if LChild = 0 then
begin
Result := 0;
Exit;
end;
Result := Find_Window(LChild, XFromIndex + 1, XClassNames);
if Result <> 0 then
Exit;
end;
end;
function FindDesktopIconWindow(var RetParent, RetChild: HWND): Boolean;
var
LDesktop: HWND;
begin
LDesktop := GetDesktopWindow;
RetChild := Find_Window(LDesktop, 0, ['Progman', 'SHELLDLL_DefView', 'SysListView32']);
if RetChild = 0 then
begin
RetChild := Find_Window(LDesktop, 0, ['WorkerW', 'SHELLDLL_DefView', 'SysListView32']);
end;
if RetChild <> 0 then
begin
RetParent := GetParent(GetParent(RetChild));
end;
Result := (RetChild <> 0) and (RetParent <> 0) and (RetParent <> LDesktop);
end;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。