我想点击一个按钮直接打开windows的资源管理器,默认路径由我自己指定,应该怎么实现?我用delphi5,directoryListbox好像不是非常好使,请各位支招。

解决方案 »

  1.   

    是这样,我考虑了一下,既然win+e就能打开windows资源管理器,我可以模拟快捷键,但是无法指定其默认路径楼上的兄弟能不能跟我说一下怎么用directoryListbox完成上述功能呢?谢谢
      

  2.   

    有没有想赢得api可以打开资源管理器?
      

  3.   

    ShellExecute(0, 'explore', 'C:\', nil, nil, SW_RESTORE);
      

  4.   

    用ShellExecute()
    参数:
    1> nil{handle to parent window}
    2> 'open'{pointer to string that specifies operation to perform.包括:open, print, explore}
    3> 'Explore.exe'{pointer to filename or folder name string}
    4> '参数'{pointer to string that specifies executable-file parameters}
    5> 'C:\WINNT'{pointer to string that specifies default directory}
    6> SW_RESTORE{whether file is shown when opened}
    {包括:SW_HIDE,SW_MAXIMIZE,SW_MINIMIZE,SW_RESTORE,SW_SHOW,SW_SHOWDEFAULT,SW_SHOWMAXIMIZED,SW_SHOWMINIMIZED,SW_SHOWMINNOACTIVE,SW_SHOWNA,SW_SHOWNOACTIVATE,SW_SHOWNORMAL.
    注意:If 如果文件名称包括文档文件,这个参数必须是0}
    ShellExecute有2种效果,一种是类似我的电脑的,另一种是类似资源管理器的。
    看看Delphi带的Win32SDK帮助就知道了。
      

  5.   

    ShellExecute(0, 'explore', 'C:\', nil, nil, SW_RESTORE);