Einzelnen Beitrag anzeigen

Benutzerbild von Rastaman
Rastaman

Registriert seit: 6. Jan 2005
Ort: Lübbecke
575 Beiträge
 
Turbo C++
 
#2

Re: Desktop: Iconansicht -> Listenansicht ?

  Alt 20. Okt 2005, 13:52
Delphi-Quellcode:
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.
Funzt! Grad ausprobiert, finds ne coole Idee
SetView is von Luckies nonVCL Tutorials.
Wichtig: CommCtrl einbinden.
Chuck Norris has counted to infinity ... twice!
  Mit Zitat antworten Zitat