Delphi 把文件锁定到任务栏


本文整理自网络,侵删。

 uses ComObj;
   
procedure CrnPinAppToWin7Taskbar(strPath, strApp: string);
var
  vShell, vFolder, vFolderItem, vItemVerbs: Variant;
  vPath, vApp: Variant;
  i: Integer;
  str, strPinName: String;
begin
  vShell := CreateOleObject('Shell.Application');
  vPath := strPath;
  vFolder := vShell.NameSpace(vPath);
  vApp := strApp;
  vFolderItem := vFolder.ParseName(vApp);
  vItemVerbs := vFolderItem.Verbs;
   
  // 以下的PinName只适用于中文版的系统
  // 英文版的系统要用'Pin to Tas&kbar'
  // strPinName :='Pin to Tas&kbar';
  strPinName :='锁定到任务栏(&K)';
   
  for i :=1to vItemVerbs.Count do
  begin
    str := vItemVerbs.Item(i).Name;
   
    if SameText(str, strPinName) then
    begin
      //63637275 6E 2E 63 6F 6D
      vItemVerbs.Item(i).DoIt;
    end;
  end;
end;
   
procedure TForm1.Button1Click(Sender: TObject);
begin
  CrnPinAppToWin7Taskbar('C:\windows', 'regedit.exe');
end;

相关阅读 >>

Delphi中in的使用

Delphi windows 编程[21] - wm_menuselect 消息与 getmenustring 函数

Delphi twebbrowser 获取cookie

Delphi comparestr 这个函数可以模糊匹配,且不区分大小写

阻止删除文件(文件占坑)的Delphi代码

Delphi中quotedstr介绍及使用

Delphi 如何得到 winrar 处理解压缩文件的返回值 ?

Delphi 个人所得税计算函数

Delphi 路径有空格调用批处理

获取 ip138 ip 地址

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...