Delphi打开exe 打开文件夹 打开文件夹选中行文件
发布:智码IT网 阅读:53
//打开windows自带 计算器 程序 calc.exe
//注意:需要引用Winapi.ShellAPI,Winapi.Windows
//use Winapi.ShellAPI,Winapi.Windows;
ShellExecute(Application.Handle, 'open', PWideChar('calc.exe'), '-s', '', SW_SHOWNORMAL);
//打开自身exe文件所在文件夹sDir
//注意:需要引用Winapi.ShellAPI
var sDir := ExtractFilePath(Application.ExeName);
// uses Winapi.ShellAPI;
ShellExecute(Handle, 'open', 'Explorer.exe', PChar(sDir), nil, 1);
//打开文件夹 选中文件
var strZipPath := 'D:\test.zip';
ShellExecute(Handle,nil,'explorer',PChar('/select,'+strZipPath),nil,SW_SHOWNORMAL);