unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, CommCtrl;
type
TForm1 =
class(TForm)
ListView1: TListView;
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure SetView(hWndListView: HWND; dwView: dword);
var
dwStyle : dword;
begin
dwStyle := GetWindowLong(hWndListView,GWL_STYLE);
if(dwStyle
and LVS_TYPEMASK <> dwView)
then
SetWindowLong(hWndListView,GWL_STYLE,
dwStyle
and not LVS_TYPEMASK
or dwView);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
wnd: HWND;
begin
wnd := FindWindow('
Progman','
Program Manager');
wnd := FindWindowEx(wnd, 0, '
SHELLDLL_DefView',
nil);
wnd := FindWindowEx(wnd, 0, '
SysListView32',
nil);
SetView(wnd, LVS_SMALLICON);
end;
end.