抄一段元程序给你
function GetOpenFileNameEx(var OpenFile: TOpenFilenameEx): Bool; stdcall;type
TOpenFileNameEx = packed record
lStructSize: DWORD;
hWndOwner: HWND;
hInstance: HINST;
lpstrFilter: PAnsiChar;
lpstrCustomFilter: PAnsiChar;
nMaxCustFilter: DWORD;
nFilterIndex: DWORD;
lpstrFile: PAnsiChar;
nMaxFile: DWORD;
lpstrFileTitle: PAnsiChar;
nMaxFileTitle: DWORD;
lpstrInitialDir: PAnsiChar;
lpstrTitle: PAnsiChar;
Flags: DWORD;
nFileOffset: Word;
nFileExtension: Word;
lpstrDefExt: PAnsiChar;
lCustData: LPARAM;
lpfnHook: function(Wnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): UINT stdcall;
lpTemplateName: PAnsiChar;
pvReserved : Pointer;
dwReserved : DWORD;
FlagsEx : DWORD;
end;implementationuses Consts, Forms, CommDlg, Dlgs, ExtDlgs;function GetOpenFileNameEx; external 'comdlg32.dll' name 'GetOpenFileNameA';function OpenInterceptor(var DialogData: TOpenFileName): Bool; stdcall;
var DialogDataEx : TOpenFileNameEx;
begin
Move(DialogData, DialogDataEx, sizeof(DialogDataEx));
if CurInstanceShowPlacesBar then
DialogDataEx.FlagsEx := 0
else
DialogDataEx.FlagsEx := 1;
DialogDataEx.lStructSize := sizeof(TOpenFileNameEx);
Result := GetOpenFileNameEx( DialogDataEx );
end;constructor TAgOpenDialog.Create(AOwner: TComponent);
begin
inherited;
FShowPlacesBar := TRUE;
FInterceptor := @OpenInterceptor;
end;function TAgOpenDialog.Execute: Boolean;
var Inst : Pointer;
begin
if IsWin2000 then
begin
CurInstanceShowPlacesBar := FShowPlacesBar;
Result := DoExecute(FInterceptor);
end
else
Result := inherited Execute;
end;
function GetOpenFileNameEx(var OpenFile: TOpenFilenameEx): Bool; stdcall;type
TOpenFileNameEx = packed record
lStructSize: DWORD;
hWndOwner: HWND;
hInstance: HINST;
lpstrFilter: PAnsiChar;
lpstrCustomFilter: PAnsiChar;
nMaxCustFilter: DWORD;
nFilterIndex: DWORD;
lpstrFile: PAnsiChar;
nMaxFile: DWORD;
lpstrFileTitle: PAnsiChar;
nMaxFileTitle: DWORD;
lpstrInitialDir: PAnsiChar;
lpstrTitle: PAnsiChar;
Flags: DWORD;
nFileOffset: Word;
nFileExtension: Word;
lpstrDefExt: PAnsiChar;
lCustData: LPARAM;
lpfnHook: function(Wnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): UINT stdcall;
lpTemplateName: PAnsiChar;
pvReserved : Pointer;
dwReserved : DWORD;
FlagsEx : DWORD;
end;implementationuses Consts, Forms, CommDlg, Dlgs, ExtDlgs;function GetOpenFileNameEx; external 'comdlg32.dll' name 'GetOpenFileNameA';function OpenInterceptor(var DialogData: TOpenFileName): Bool; stdcall;
var DialogDataEx : TOpenFileNameEx;
begin
Move(DialogData, DialogDataEx, sizeof(DialogDataEx));
if CurInstanceShowPlacesBar then
DialogDataEx.FlagsEx := 0
else
DialogDataEx.FlagsEx := 1;
DialogDataEx.lStructSize := sizeof(TOpenFileNameEx);
Result := GetOpenFileNameEx( DialogDataEx );
end;constructor TAgOpenDialog.Create(AOwner: TComponent);
begin
inherited;
FShowPlacesBar := TRUE;
FInterceptor := @OpenInterceptor;
end;function TAgOpenDialog.Execute: Boolean;
var Inst : Pointer;
begin
if IsWin2000 then
begin
CurInstanceShowPlacesBar := FShowPlacesBar;
Result := DoExecute(FInterceptor);
end
else
Result := inherited Execute;
end;
http://vcl.vclxx.org/DELPHIGB/AAAT1021.HTM
AGOPENDIALOG.ZIP