...Open TCommonDialog in Thumbnail, Report view?

Author: Thomas Stutz

Category: VCL

private
    
{ Private declarations }
    
procedure WMUser(var msg: TMessage); message WM_USER+1;
  public
    
{ Public declarations }
  
end;

var
  
Form1: TForm1;

implementation

{$R *.dfm}


const
  
FCIDM_SHVIEW_LARGEICON  = 28713;
  FCIDM_SHVIEW_SMALLICON  = 28714;
  FCIDM_SHVIEW_LIST       = 28715;
  FCIDM_SHVIEW_REPORT     = 28716;
  FCIDM_SHVIEW_THUMBNAIL  = 28717; //    XP only
  
FCIDM_SHVIEW_TILE       = 28718; //    XP

procedure TForm1.WMUser(var msg: TMessage);
var
 
Dlg: HWND;
 Ctrl: HWND;
begin
  
Dlg := msg.WParam;
  Ctrl := FindWindowEx(Dlg, 0, PChar('SHELLDLL_DefView'), nil);
  if Ctrl <> 0 then
  begin
    
SendMessage(Ctrl, WM_COMMAND, FCIDM_SHVIEW_THUMBNAIL, 0 )
  end;
end;

procedure TForm1.OpenDialog1Show(Sender: TObject);
var
  
Dlg: HWND;
begin
  
Dlg := GetParent((Sender as TOpenDialog).Handle);
  PostMessage(Handle, WM_USER+1, Dlg, 0);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if 
OpenDialog1.Execute then
  begin
  end
;
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base