| 
			Author: Jonas Bilinkevicius
How to remove the 'Create new folder' button of a TOpenDialog
Answer:
Here is how you can remove the 'Create new folder' button on a TOpenDialog. Look at 
the lines at the bottom this procedure. But note that although the button is no 
longer present, it's still possible to create a new folder in the dialog, as well 
as all other kinds of file/ directory manipulation.
1   { ... }
2   type
3     TForm1 = class(TForm)
4       OpenDialog1: TOpenDialog;
5     private
6       { Private declarations }
7       procedure MoveDialog(var Msg: TMessage); message WM_USER;
8     public
9       { Public declarations }
10    end;
11  
12  var
13    Form1: TForm1;
14  
15  implementation
16  
17  {$R *.DFM}
18  
19  procedure TForm1.MoveDialog(var Msg: TMessage);
20  var
21    rec: TRect;
22    wh: HWND;
23    l, t, r, b: Integer;
24  begin
25    {Center OpenDialog over form}
26    if ofOldStyleDialog in OpenDialog1.Options then
27      wh := OpenDialog1.Handle
28    else
29      wh := Windows.GetParent(OpenDialog1.Handle);
30    if IsWindow(wh) then
31      if GetWindowRect(wh, rec) then
32      begin
33        l := (Width - (rec.Right - rec.Left)) div 2 + Left;
34        t := (Height - (rec.Bottom - rec.Top)) div 2 + Top;
35        r := rec.Right - rec.Left;
36        b := rec.Bottom - rec.Top;
37        MoveWindow(wh, l, t, r, b, True);
38      end;
39    if not (ofOldStyleDialog in OpenDialog1.Options) then
40    begin
41      {Remove the 'Create new folder' toolbutton}
42      wh := Windows.GetParent(OpenDialog1.Handle);
43      wh := FindWindowEx(wh, 0, 'ToolbarWindow32', nil);
44      if wh <> 0 then
45        SendMessage(wh, TB_DELETEBUTTON, 5, 0); {uses Commctrl}
46      {Warning: 5 is the ID-number of the 'Create new folder' toolbutton. 
47  		It may possibly change on different Windows versions.}
48    end;
49  end;
			 |