1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| procedure TFrmTestDivers.Button8Click(Sender: TObject);
var
Style: Longint;
HandleList: HWND;
i: Integer;
const
LVM_SETVIEW = $108E;
LV_VIEW_TILE = 4;
begin
HandleList := FoundChild(PanelWebBrowser.Handle, 'SysListView32', 'FolderView');
Style := GetWindowLong(HandleList, GWL_STYLE);
Style := Style and (not LVS_TYPEMASK);
Style := Style or LVS_LIST;
// SetWindowLong(HandleList, GWL_STYLE, Style);
SendMessage(HandleList, LVM_SETVIEW, LV_VIEW_TILE, 0);
end;
function FoundChild(Parent: THandle; const ClassName, WindowName: string; ChildIndex: Integer = 0): THandle;
var
HandleFound: THandle;
lpRes : array[0..256] of Char;
StrClass: string;
StrCaption: string;
iChild: Integer;
begin
Result := 0;
iChild := -1;
HandleFound := GetWindow(Parent, GW_CHILD);
while HandleFound > 0 do
begin
GetClassName(HandleFound, lpRes, SizeOf(lpRes));
StrClass := lpRes;
GetWindowText(HandleFound, lpRes, SizeOf(lpRes));
StrCaption := lpRes;
if ((ClassName = '') or SameText(ClassName, StrClass)) and ((WindowName = '') or SameText(WindowName, StrCaption)) then
begin
Inc(iChild);
if iChild >= ChildIndex then begin
Result := HandleFound;
Exit;
end;
end else
begin
Result := FoundChild(HandleFound, ClassName, WindowName, ChildIndex);
if Result > 0 then Exit;
end;
HandleFound := GetWindow(HandleFound, GW_HWNDNEXT);
end;
end; |
Partager