Edu*_*uro 9 delphi windows-explorer shellexecute
使用以下内容
explorer.exe /select, "c:\path\to\file.txt"
Run Code Online (Sandbox Code Playgroud)
我可以打开Windows资源管理器并选择该文件.在Delphi中我这样选择"Parm"文件:
ShellExecute(Application.MainForm.Handle, 'OPEN', PChar('explorer.exe'), PChar('/select,"' + Parm + '"'), nil, SW_NORMAL);
Run Code Online (Sandbox Code Playgroud)
它有效.我的问题是这样的:如果我在最近打开的资源管理器中选择一个不同的文件(单击另一个文件),然后调用上面的代码,则不再选择"Parm"文件.有趣的是,有一些程序再次选择文件.例如,ITunes总是选择所需的文件.
有没有人知道如何让Explorer始终选择指定的文件?
Pau*_*Jan 13
这是使用/ select开关和explorer.exe的已知限制,如果父文件夹尚未打开,它将仅选择特定文件.
你必须使用像SHOpenFolderAndSelectItems这样的API调用.此功能还允许多选.