试试属性
Options =[ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing]

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      ofn:tagOFNA;
      szFile:Pchar;
    begin
    GetMem(szFile,260);
    ZeroMemory(szFile,260);
    ZeroMemory(@ofn, sizeof(tagOFNA));
    ofn.lStructSize := sizeof(tagOFNA);
    ofn.hwndOwner := Application.Handle;
    ofn.lpstrFile := szFile;
    ofn.nMaxFile := 260;
    ofn.lpstrFilter := pchar('All'#0'*.*'#0'Text'#0'*.TXT'#0);
    ofn.nFilterIndex := 1;
    ofn.lpstrFileTitle := nil;
    ofn.nMaxFileTitle := 0;
    ofn.lpstrInitialDir := nil;//这里填入你的路径
    ofn.Flags := OFN_PATHMUSTEXIST or OFN_FILEMUSTEXIST;
    if (GetOpenFileName(ofn))then
      ShowMessage(szFile)FreeMem(szFile);end;
      

  2.   

    设置OPENFILENAME结构的lpfnHook属性可以设置回调函数在回调函数中响应消息可以扩展 打开/保存对话框的功能
    比如可以加上图像预览的功能(我写的:http://zyl910vb.51.net/vb/wdzp/MyOpenDlg.htm,注意下载后把*.zip.jpg改名成*.zip)
    现在发现MSDN没有对 在对话框打开时 设置浏览路径的方法!所以才跑到这里问!
      

  3.   

    设置OPENFILENAME结构的lpfnHook属性可以设置回调函数在回调函数中响应消息可以扩展 打开/保存对话框的功能
    比如可以加上图像预览的功能(我写的:http://zyl910vb.51.net/vb/wdzp/MyOpenDlg.htm,注意下载后把*.zip.jpg改名成*.zip)
    现在发现MSDN没有对 在对话框打开时 设置浏览路径的方法!所以才跑到这里问!
      

  4.   

    oFileName.lpstrInitialDir :='c:\';
    就可以设置打开对话框的路径啊
      

  5.   

    你确定你认真找了
    lpstrInitialDir 
    Pointer to a null terminated string that can specify the initial directory. The algorithm for selecting the initial directory varies on different platforms. 
      

  6.   

    uses
      CommDlg;type //定义打开文件对话框信息结构回调函数
      TLPOFNHOOKPROC = function(h: hwnd; uMsg: UINT; wp: wparam; lp: lParam): integer;
    type //定义打开文件对话框信息结构
      TOpenInfo = packed record
        lStructSize: dword;
        hwndOwner: hwnd;
        hInstance: Hwnd;
        lpstrFilter: LPCTSTR;
        lpstrCustomFilter: LPTSTR;
        nMaxCustFilter: dword;
        nFilterIndex: dword;
        lpstrFile: lptstr; //该参数使用来存放对话框返回的文件名(包含路径)的,得是一个至少256个长的Pchar
        nMaxFile: dword; //该参数使用来指定info.lpstrFile长度以及存放对话框返回的文件名的长度的
        lpstrFileTitle: lptstr;
        nMaxFileTitle: dword;
        lpstrInitialDir: lpctstr;
        lpstrTitle: lpctstr;
        Flags: dword;
        nFileOffset: word;
        nFileExtension: word;
        lpstrDefExt: lpctstr;
        lCustData: Lparam;
        lpfnHook: TLPOFNHOOKPROC;
        lpTemplateName: lpctstr;
        pvReserved: integer;
        dwReserved: dword;
        FlagsEx: dword;
      end;function GetOpenFileName(var info: TOpenInfo): Boolean; stdcall; external 'comdlg32.dll' name 'GetOpenFileNameA';procedure TForm1.Button1Click(Sender: TObject);
    var
      info: TOpenInfo;
      lpstrFile: array[0..1000] of char;
      lpstrFileTitle: array[0..1000] of char;
      lpstrFilter: array[0..50] of char;
      S: string;
    begin
      FillChar(lpstrFile, SizeOf(lpstrFile), 0);
      FillChar(lpstrFileTitle, SizeOf(lpstrFileTitle), 0);
      FillChar(lpstrFilter, SizeOf(lpstrFilter), 0);
      S := '文本文件';
      Move(S[1], lpstrFilter, Length(S));
      S := '*.TXT';
      Move(S[1], lpstrFilter[9], Length(S));  info.lStructSize := sizeof(info);
      info.hWndOwner := handle;
      info.hInstance := hinstance;
      info.lpstrFilter := lpstrFilter;
      info.lpstrCustomFilter := nil;
      info.nMaxCustFilter := 0;
      info.nFilterIndex := 1;
      info.lpstrFile := lpstrFile;
      info.nMaxFile := SizeOf(lpstrFile);
      info.lpstrFileTitle := lpstrFileTitle;
      info.nMaxFileTitle := SizeOf(lpstrFileTitle);
      info.lpstrInitialDir := 'c:\';
      info.lpstrTitle := 'Open Test';
      info.Flags := OFN_EXPLORER + OFN_ALLOWMULTISELECT;
      info.nFileOffset := 0;
      info.nFileExtension := 0;
      info.lpstrDefExt := 'txt';
      info.lCustData := 0;
      info.lpfnHook := nil;
      info.lpTemplateName := '';
      info.pvReserved := 0;
      info.dwReserved := 0;
      info.FlagsEx := 0;
      try
        if GetOpenFileName(info) then
          ShowMessage(info.lpstrFile);
      except
        Caption := SysErrorMessage(getlasterror);
      end;
    end;
      

  7.   

    MSDN对于设置打开对话框的回调函数的说明只有这么一点:Explorer-Style Hook Procedures
    You can customize an Explorer-style Open or Save As dialog box by providing a hook procedure, a custom template, or both. If you provide a hook procedure for an Explorer-style dialog box, the system creates a dialog box that is a child of the default dialog box. The hook procedure acts as the dialog procedure for the child dialog box. This child dialog box is based on the custom template, or on a default template if none is provided. For more information, see Explorer-Style Custom Templates.To enable a hook procedure for an Explorer-style Open or Save As dialog box, use the OPENFILENAME structure when you create the dialog box. Set the OFN_ENABLEHOOK and OFN_EXPLORER flags in the Flags member and specify the address of an OFNHookProc hook procedure in the lpfnHook member. If you provide a hook procedure and omit the OFN_EXPLORER flag, you must use an OFNHookProcOldStyle hook procedure and you will get the old-style user-interface. For more information, see Customizing Old-Style Dialog Boxes. An Explorer-style hook procedure receives a variety of messages while the dialog box is open. These include the following: The WM_INITDIALOG message and other standard dialog box messages such as the WM_CTLCOLORDLG control color message. 
    A set ofWM_NOTIFY notification messages indicating actions taken by the user or other dialog box events. 
    Messages for any additional controls that you defined by specifying a child dialog template. 
    In addition, there is a set of messages that you can send to an Explorer-style dialog box to get information or to control the behavior and appearance of the dialog box.If you provide a hook procedure for an Explorer-style dialog box, the default dialog box procedure creates a child dialog box when the default dialog procedure is processing its WM_INITDIALOG message. The hook procedure acts as the dialog procedure for the child dialog box. At this time, the hook procedure receives its own WM_INITDIALOG message with the lParam parameter set to the address of the OPENFILENAME structure used to initialize the dialog box. After the child dialog finishes processing its own WM_INITDIALOG message, the default dialog procedure moves the standard controls, if necessary, to make room for any additional controls of the child dialog box. The default dialog procedure then sends the CDN_INITDONE notification message to the hook procedure. The hook procedure receivesWM_NOTIFY notification messages indicating actions taken by the user in the dialog box. You can use some of these messages to control the behavior of the dialog box. For example, the hook procedure receives the CDN_FILEOK message when the user chooses a filename and clicks the OK button. In response to this message, the hook procedure can use the SetWindowLong function to reject the selected name and force the dialog box to remain open.The lParam parameter for each WM_NOTIFY message is a pointer to an OFNOTIFY structure that defines the action. The code member in the header for the OFNOTIFY structure contains one of the following notification codes.CDN_FILEOK The user clicked the OK button; the dialog box is about to close.  
    CDN_FOLDERCHANGE The user opened a new folder or directory. 
    CDN_HELP The user clicked the Help button. 
    CDN_INITDONE The system has finished initializing the dialog box, and the dialog box has finished processing the WM_INITDIALOG message. Also, the system has finished arranging controls in the common dialog box to make room for the controls of the child dialog box (if any). 
    CDN_SELCHANGE The user selected a new file or folder from the file list. 
    CDN_SHAREVIOLATION The common dialog box encountered a sharing violation on the file about to be returned. 
    CDN_TYPECHANGE The user selected a new file type from the list of file types. 
    These WM_NOTIFY messages supersede the FILEOKSTRING, LBSELCHSTRING, SHAREVISTRING, and HELPMSGSTRING registered messages used by previous versions of the Open and Save As dialog boxes. However, the hook procedure also receives the superseded message after the WM_NOTIFY message if the WM_NOTIFY processing does not use SetWindowLong to set a nonzero DWL_MSGRESULT value.To retrieve information about the status of the dialog box or to control the behavior and appearance of the dialog box, the hook procedure can send the following messages to the dialog box.CDM_GETFILEPATH Retrieves the path and filename of the selected file. 
    CDM_GETFOLDERIDLIST Retrieves the item identifier list corresponding to the current folder that the dialog box has open. For more information about item identifier lists, seeItem Identifiers and Identifier Lists.  
    CDM_GETFOLDERPATH Retrieves the path of the current folder or directory for the dialog box. 
    CDM_GETSPEC Retrieves the filename (not including the path) of the file currently selected in the dialog box.  
    CDM_HIDECONTROL Hides the specified control. 
    CDM_SETCONTROLTEXT Sets the text in the specified control. 
    CDM_SETDEFEXT Sets the default filename extension for the dialog box. 
      

  8.   

    我是想在Win98做一个像Win2000那样的打开对话框
    可以左侧的列表中选择目录
      

  9.   

    我是想在Win98做一个像Win2000那样的打开对话框
    可以左侧的列表中选择目录
      

  10.   

    这个倒没做过,不过我有个WIN2K对话框的源源程序,不知对你有用否?!
    unit Win2kdlg;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      CommDlg, Printers, CommCtrl;const OFN_EX_PLACESBAR = 0;
          OFN_EX_NOPLACESBAR = 1;
          START_PAGE_GENERAL = 0;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;  HPropSheetPage = record
        lppsp: _PropSheetHeader;
      end;  lpPrintPageRange = record
        nFromPage: DWORD;
        nToPage: DWORD;
      end;  TPrintDlgEx = packed record
        lStructSize: DWORD;
        hWndOwner: HWND;
        hDevMode: HGLOBAL;
        hDevNames: HGLOBAL;
        hDC: HDC;
        Flags: DWORD;
        Flags2: DWORD;
        ExclusionFlags: DWORD;
        nPageRanges: DWORD;
        nMaxPageRanges: DWORD;
        lpPageRanges: lpPrintPageRange;
        nMinPage: Word;
        nMaxPage: Word;
        nCopies: Word;
        hInstance: HINST;
        lpPrintTemplateName: PWideChar;
        lpCallBack: Pointer;
        nPropertyPages: DWORD;
        lphPropertyPages: HPropSheetPage;
        nStartPage: DWORD;
        dwResultAction: DWORD;
      end;
    type
      TOpenDialogEx = class(TOpenDialog)
      private
        FShowPlacesbar: boolean;
      protected
      public
        constructor Create(AOwner: TComponent); override;
        function Execute: boolean; override;
      published
        property ShowPlacesBar: boolean read FShowPlacesBar write FShowPlacesBar;
      end;type
      TSaveDialogEx = class(TSaveDialog)
      private
        FShowPlacesbar: boolean;
      protected
      public
        constructor Create(AOwner: TComponent); override;
        function Execute: boolean; override;
      published
        property ShowPlacesBar: boolean read FShowPlacesBar write FShowPlacesBar;
      end;type
      TPrintDialogEx = class(TPrintDialog)
      private
        FShowPrinterBar: boolean;
        function PrintInterceptor: Boolean;
      protected
      public
        constructor Create(AOwner: TComponent); override;
        function Execute: boolean; override;
      published
        property ShowPrintersbar: boolean read FShowPrinterBar write FShowPrinterBar;
      end;procedure Register;function GetOpenFileNameEx(var OpenFile: TopenFileNameEx): bool; stdcall;
    function GetSaveFileNameEx(var SaveFile: TOpenFileNameEx): bool; stdcall;
    //function PrintDlgEx(var PrintDlgRec: TPrintDlgEx): Bool; stdcall;implementationvar CurInstShowPlaceBar: boolean;
        //HookCtl3D: Boolean;function GetOpenFileNameEx;     external 'comdlg32.dll' name 'GetOpenFileNameA';
    function GetSaveFileNameEx;     external 'comdlg32.dll' name 'GetSaveFileNameA';
    //function PrintDlgEx;            external 'comdlg32.dll' name 'PrintDlgExA';{Printer functions ********************************************************}//procedure GetPrinter(var DeviceMode, DeviceNames: THandle);
    //var
    //  Device, Driver, Port: array[0..79] of char;
    //  DevNames: PDevNames;
    //  Offset: PChar;
    //begin
    //  Printer.GetPrinter(Device, Driver, Port, DeviceMode);
    //  if DeviceMode <> 0 then
    //  begin
    //    DeviceNames := GlobalAlloc(GHND, SizeOf(TDevNames) +
    //     StrLen(Device) + StrLen(Driver) + StrLen(Port) + 3);
    //    DevNames := PDevNames(GlobalLock(DeviceNames));
    //    try
    //      Offset := PChar(DevNames) + SizeOf(TDevnames);
    //      with DevNames^ do
    //      begin
    //        wDriverOffset := Longint(Offset) - Longint(DevNames);
    //        Offset := StrECopy(Offset, Driver) + 1;
    //        wDeviceOffset := Longint(Offset) - Longint(DevNames);
    //        Offset := StrECopy(Offset, Device) + 1;
    //        wOutputOffset := Longint(Offset) - Longint(DevNames);;
    //        StrCopy(Offset, Port);
    //      end;
    //    finally
    //      GlobalUnlock(DeviceNames);
    //    end;
    //  end;
    //end;
    //
    //procedure SetPrinter(DeviceMode, DeviceNames: THandle);
    //var
    //  DevNames: PDevNames;
    //begin
    //  DevNames := PDevNames(GlobalLock(DeviceNames));
    //  try
    //    with DevNames^ do
    //      Printer.SetPrinter(PChar(DevNames) + wDeviceOffset,
    //        PChar(DevNames) + wDriverOffset,
    //        PChar(DevNames) + wOutputOffset, DeviceMode);
    //  finally
    //    GlobalUnlock(DeviceNames);
    //    GlobalFree(DeviceNames);
    //  end;
    //end;
    //
    //function CopyData(Handle: THandle): THandle;
    //var
    //  Src, Dest: PChar;
    //  Size: Integer;
    //begin
    //  if Handle <> 0 then
    //  begin
    //    Size := GlobalSize(Handle);
    //    Result := GlobalAlloc(GHND, Size);
    //    if Result <> 0 then
    //      try
    //        Src := GlobalLock(Handle);
    //        Dest := GlobalLock(Result);
    //        if (Src <> nil) and (Dest <> nil) then Move(Src^, Dest^, Size);
    //      finally
    //        GlobalUnlock(Handle);
    //        GlobalUnlock(Result);
    //      end
    //  end
    //  else Result := 0;
    //end;
    //
      

  11.   

    function IsWindows2000: boolean;
    var ver: TOSVersionInfo;
    begin
      Result := false;
      ver.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
      if not GetVersionEx(ver) then
        Exit;
      if (ver.dwPlatformID = VER_PLATFORM_WIN32_NT) then
        if (ver.dwMajorVersion >= 5) then
          Result := true;
    end;
    procedure Register;
    begin
      RegisterComponents('VoiceWin2K', [TOpenDialogEx]);
      RegisterComponents('VoiceWin2K', [TSaveDialogEx]);
      RegisterComponents('voiceWin2K', [TPrintDialogEx]);
    end;{Print Dialog Functions}(*procedure CenterWindow(Wnd: HWnd);
    var
      Rect: TRect;
      Monitor: TMonitor;
    begin
      GetWindowRect(Wnd, Rect);
      if Application.MainForm <> nil then
        Monitor := Application.MainForm.Monitor
      else
        Monitor := Screen.Monitors[0];
      SetWindowPos(Wnd, 0,
        Monitor.Left + ((Monitor.Width - Rect.Right + Rect.Left) div 2),
        Monitor.Top + ((Monitor.Height - Rect.Bottom + Rect.Top) div 3),
        0, 0, SWP_NOACTIVATE or SWP_NOSIZE or SWP_NOZORDER);
    end;{ Generic dialog hook. Centers the dialog on the screen in response to
      the WM_INITDIALOG message }function DialogHook(Wnd: HWnd; Msg: UINT; WParam: WPARAM; LParam: LPARAM): UINT; stdcall;
    begin
      Result := 0;
      case Msg of
        WM_INITDIALOG:
          begin
            if HookCtl3D then
            begin
              Subclass3DDlg(Wnd, CTL3D_ALL);
              SetAutoSubClass(True);
            end;
            CenterWindow(Wnd);
            CreationControl.FHandle := Wnd;
            CreationControl.FDefWndProc := Pointer(SetWindowLong(Wnd, GWL_WNDPROC,
              Longint(CreationControl.FObjectInstance)));
            CallWindowProc(CreationControl.FObjectInstance, Wnd, Msg, WParam, LParam);
            CreationControl := nil;
          end;
        WM_DESTROY:
          if HookCtl3D then SetAutoSubClass(False);
      end;
    end;         *)
    {done with these}
    function OpenInterceptor(var DialogData: TOpenFileName): bool; stdcall;
    var DialogDataEx: TOpenFileNameEx;
    begin
      Move(DialogData, DialogDataEx, SizeOf(DialogData));
      if CurInstShowPlaceBar then
        DialogDataEx.FlagsEx := OFN_EX_PLACESBAR
      else
        DialogDataEx.FlagsEx := OFN_EX_NOPLACESBAR;
      DialogDataEx.lStructSize := SizeOf(TOpenFileNameEx);
      Result := GetOpenFileNameEx(DialogDataEx);
    end;function SaveInterceptor(var DialogData: TOpenFileName): bool; stdcall;
    var DialogDataEx: TOpenFileNameEx;
    begin
      Move(DialogData, DialogDataEx, SizeOf(DialogData));
      if CurInstShowPlaceBar then
        DialogDataEx.FlagsEx := OFN_EX_PLACESBAR
      else
        DialogDataEx.FlagsEx := OFN_EX_NOPLACESBAR;
      DialogDataEx.lStructSize := SizeOf(TOpenFileNameEx);
      Result := GetSaveFileNameEx(DialogDataEx);
    end;function TPrintDialogEx.PrintInterceptor: Boolean;
    const
      PrintRanges: array[TPrintRange] of Integer =
        (PD_ALLPAGES, PD_SELECTION, PD_PAGENUMS);
    var
      PrintDlgRec: TPrintDlgEx;
      //DevHandle: THandle;
    begin
         Result := false;
    //  PrintDlgEx(PrintDlgRec);  FillChar(PrintDlgRec, SizeOf(PrintDlgRec), 0);
      with PrintDlgRec do
      begin
        lStructSize := sizeof(PrintDlgRec);
        hwndOwner := Application.Handle;
        hDevMode := 0;
        hDevNames := 0;
        hDC := 0;
        Flags := PD_ReturnDC or PD_Collate;
        Flags2 := 0;
        ExclusionFlags := 0;
        nMaxPageRanges := 10;
        lpPageRanges.nFromPage := 0;
        lpPageRanges.nToPage := 10;
        nMinPage := 1;
        nMaxPage := 1000;
        nCopies := 1;
        hInstance := 0;
        lpPrintTemplateName := nil;
        lpCallback := nil;
        nPropertyPages := 0;
    //    lphPropertyPages.lppsp := null;
        nStartPage := Start_Page_General;
        dwResultAction := 0;{    lStructSize := SizeOf(PrintDlgRec);
        hInstance := SysInit.HInstance;
        GetPrinter(DevHandle, hDevNames);
        hDevMode := CopyData(DevHandle);
        hDevNames := 0;
        Flags := PD_ALLPAGES;
    {    if Collate then Inc(Flags, PD_COLLATE);
        if not (poPrintToFile in Options) then Inc(Flags, PD_HIDEPRINTTOFILE);
        if not (poPageNums in Options) then Inc(Flags, PD_NOPAGENUMS);
        if not (poSelection in Options) then Inc(Flags, PD_NOSELECTION);
        if poDisablePrintToFile in Options then Inc(Flags, PD_DISABLEPRINTTOFILE);
        if PrintToFile then Inc(Flags, PD_PRINTTOFILE);
        if poHelp in Options then Inc(Flags, PD_SHOWHELP);
        if not (poWarning in Options) then Inc(Flags, PD_NOWARNING);}
     {   lpPageRanges.nFromPage := FromPage;
        lpPageRanges.nToPage := ToPage;
        nMinPage := MinPage;
        nMaxPage := MaxPage;
        nPropertyPages := 1;
        nStartPage := START_PAGE_GENERAL;
    //    HookCtl3D := Ctl3D;
        hWndOwner := Application.Handle;
        Flags2 := 0;
    //    Result := TaskModalDialog(@PrintDlgEx, PrintDlgRec);}
    //    Result := PrintDlgEx(PrintDlgRec);
        if Result then
        begin
    //      SetPrinter(hDevMode, hDevNames);
    //      FCollate := Flags and PD_COLLATE <> 0;
    //      FPrintToFile := Flags and PD_PRINTTOFILE <> 0;
    //      if Flags and PD_SELECTION <> 0 then FPrintRange := prSelection else
    //        if Flags and PD_PAGENUMS <> 0 then FPrintRange := prPageNums else
    //          FPrintRange := prAllPages;
    //      FFromPage := nFromPage;
    //      FToPage := nToPage;
          if nCopies = 1 then
            Copies := Printer.Copies else
            Copies := nCopies;
        end
        else begin
          if hDevMode <> 0 then GlobalFree(hDevMode);
          if hDevNames <> 0 then GlobalFree(hDevNames);
        end;
      end;
    end;
    constructor TOpenDialogEx.Create(AOwner: TComponent);
    begin
      inherited Create(AOwner);
    end;function TOpenDialogEx.Execute: boolean;
    begin
      if IsWindows2000 then
        begin
          CurInstShowPlaceBar := FShowPlacesBar;
          Result := DoExecute(@OpenInterceptor);
        end
      else
        Result := inherited Execute;
    end;{ TSaveDialogEx }constructor TSaveDialogEx.Create(AOwner: TComponent);
    begin
      inherited Create(AOwner);
    end;function TSaveDialogEx.Execute: boolean;
    begin
      if IsWindows2000 then
        begin
          CurInstShowPlaceBar := FShowPlacesBar;
          Result := DoExecute(@SaveInterceptor);
        end
      else
        Result := inherited Execute;
    end;{ TPrintDialogEx }constructor TPrintDialogEx.Create(AOwner: TComponent);
    begin
      inherited Create(AOwner);
    end;function TPrintDialogEx.Execute: boolean;
    begin
      if IsWindows2000 then
        begin
          CurInstShowPlacebar := FShowPrinterBar;
          Result := PrintInterceptor;
        end
      else
        Result := inherited Execute;
    end;end
      

  12.   

    楼主啊~~ 我是第n次来观战啦~~~我看你还是贴张Bitmap出来,
    让大家看看吧,这么多大侠在这里使招都没击中要害啊~~要是你没主页空间的话,我可以提供啊(呵呵,做好人来了^o^)
      

  13.   

    其实他的功能就是要自己实现Windows2000 Opendialog的PlaceBar的功能!Windows2000的OpenDialog,左边有一个工具栏,其中有一些按钮:如我的电脑,我的文档等,点击一下,就可以快速跳到相应的目录。你可以这样,Copy最新的(使用Win2000)的Comdlg32.dll到你的程序下面,并且使用上面的API打开文件即可。
      

  14.   

    To Kingron(沉沦中……):
    我只不过是举个例子
    不能用系统的文件列表
    我需要的是一个自己的目录列表比如:
    左侧是一个List控件
    右击List把当前路径加入列表
    双击List把对话框路径设为选择的路径To CoolSlob():
    什么图片?你能提供给我空间的话就太好了
      

  15.   

    奇怪,我用的也是2000,没有发现OpenDialog左边有什么工具栏啊.贴一张图片出来看看。
      

  16.   

    这是由于某些软件还是按照旧标准调用GetOpenFileName的
    所以没有左侧的目录列表
    你用过Office2000吗?
    Office2000里的 打开/保存对话框也有左侧的目录列表
    只不过它好像不是调用GetOpenFileName,而是另外写的
      

  17.   

    有谁用过Folder Cache没有?http://www.nesoft.org/foldercache/fc_setup.exe
    Folder Cache
      安装Folder Cache后会在打开/保存对话框中增加一个新的按钮,点击这个按钮会列出最近使用过的文件夹列表,并且可以向这个列表中添加自己常用的文件夹,还可以自由设置列表显示的文件夹数量 ……同时我在用Spy查看打开对话框的时候发现了一条WM_USER+7的消息
    可是CDM_……只到了WM_USER+6
    那是什么消息?
      

  18.   

    看错了
    CDM_……消息是WM_USER+100+n
      

  19.   

    下了那个File Cache,装了,还真不错.
    --------------------------------
    不过既然它能办到,我们也应该能办到,等我的消息,估计今晚12点前能搞定.---------------------------------研究中...
      

  20.   

    那个File Cache,装了,还真不错.
    只是运行不了~~而且xxxxxxxxxxxxxxxxxxxxxxxxx大家谨慎一点好~~
      

  21.   

    To CoolSlob():
    主要是上传我写的一些程序
      

  22.   

    TMD,那些老外就喜欢采用一些歪门邪道的技术。不知道你有没有这样的印象,如果你在那个文件名编辑框中输入一个目录名,然后按确定按钮,那个对话框并没有被关闭,而是切换到那个新的目录。那个Folder Cache就是这样工作的,只是它把这些步骤用程序自动化执行了,具体步骤如下:1、首先保存那个文件名编辑框的值
    2、在那个编辑框中设置新的目录名
    3、模拟鼠标单击“确定”按钮,这时候对话框切换到新的目录
    4、恢复原来编辑框的值----------------------------------下面是我的C++Builder代码,只贴出关键部分,其它免了。TButton *Btn;
    TPanel* Panel;
    HWND hFileNameWnd;
    HWND hOkButtonWnd;//DoShow
    void __fastcall TMyOpenDialog::DoShow(void)
    {
      TRect PreviewRect, StaticRect;  //在对话框中添加一个按钮
      GetClientRect ( this->Handle, (RECT*)&PreviewRect );
      StaticRect = this->GetStaticRect();
      PreviewRect.Left = StaticRect.Left + (StaticRect.Right - StaticRect.Left);  Panel = new TPanel(this);
      Panel->BoundsRect = PreviewRect;  Btn = new TButton(this);
      Btn->Parent = Panel;
      Btn->OnClick = ButtonClick;//设置按钮事件句柄  Panel->ParentWindow  = this->Handle;  //得到“文件名”编辑控件和“确定”按钮的句柄
      hFileNameWnd = GetDlgItem(GetParent(this->Handle),0x480);
      hOkButtonWnd = GetDlgItem(GetParent(this->Handle),1);
    }
    //---------------------------------------------------------------------------
    //ButtonClick
    void __fastcall TMyOpenDialog::ButtonClick(TObject *Sender)
    {
      if(hFileNameWnd != NULL)
      {
        char PrevBuf[64];    //先保存原来的值
        GetWindowText(hFileNameWnd,PrevBuf,sizeof(PrevBuf));    ///设置新的文件夹
        AnsiString NewPath;    NewPath = "f:\\inprise";
        SetWindowText(hFileNameWnd,NewPath.c_str());    //模拟鼠标单击“确定”按钮
        SendMessage(hOkButtonWnd,WM_LBUTTONDOWN,(WPARAM)MK_LBUTTON,(LPARAM)MAKEWORD(0,0));
        SendMessage(hOkButtonWnd,WM_LBUTTONUP,(WPARAM)MK_LBUTTON,(LPARAM)MAKEWORD(0,0));    //恢复原来的值
        SetWindowText(hFileNameWnd,PrevBuf);    //因为鼠标在“确定”上单击,所以它得到焦点,必须取消掉,否则会留下痕迹。
        //那个Folder Cache有Bug,它没有执行这一步,所以“确定”按钮仍然具有焦点,
        //从另一方面来说,这倒成为我的推断的证据^_^
        ::SetFocus(Btn->Handle);
      }
    }
    //---------------------------------------------------------------------------
      

  23.   

    :-) ,还是 [BCB_FANS(四大名捕之追杀令) ]牛……应该可以结贴了……