如何把自己的菜單加入到案頭右鍵菜單中?

來源:互聯網
上載者:User
利用註冊表,
先加入註冊表單元
uses registry
添加:
procedure TForm1.Button1Click(Sender: TObject);
var reg:tregistry;
   Filename:String;
begin
  //Project1是我的EXE檔案名稱,你的你要改
   Filename:=Trim(ExtractFileDir(Application.Exename)+/'//Project1.exe/');
   reg:=tregistry.create ;
   reg.rootkey:=hkey_classes_root;
       if   reg.OpenKey(/'//folder//shell/',true) then
         if not Reg.KeyExists(/'Project1/') then
             reg.createkey (/'Project1/');

        if   reg.OpenKey(/'//folder//shell//Project1/',true) then
          if not Reg.KeyExists(/'command/') then
             reg.createkey (/'command/');

        if reg.openkey (/'//folder//shell//Project1//command/',true) then
              reg.writestring(/'/',Filename); ///'/'連一起,不要按空格,預設值
         SHOWMESSAGE(/'已加入WINDOWS右鍵捷徑/');
    reg.CloseKey;
    reg.free
end;
刪除:
procedure TForm1.Button2Click(Sender: TObject);
var reg:tregistry;
begin
   reg:=tregistry.create ;
   reg.rootkey:=hkey_classes_root;
        if   reg.OpenKey(/'//folder//shell/',true) then
          if Reg.KeyExists(/'Project1/') then
             reg.DeleteKey(/'Project1/');
    reg.CloseKey;
    reg.free ;
     SHOWMESSAGE(/'已從WINDOWS右鍵捷徑中刪除/');
end;

以上只一類,更多
在hkey_classes_root根鍵下,就有幾個關於
修改系統功能表的子鍵,修改其下幾個鍵,就會修改相應的系統功能表。
對應的關係分別是:
  
   hkey_classes_root//folder//shell          可修改對任意檔案夾單
                                        擊右鍵彈出的菜單的功能表項目

   hkey_classes_root//directory//shell       可修改對任意目錄單擊
                                         右鍵彈出的菜單的功能表項目

   hkey_classes_root//drive//shell           可修改對任意磁碟機單
                                          擊右鍵彈出的菜單的功能表項目

   hkey_classes_root//*//shell               可修改對任意檔案單擊右
                                           鍵彈出的菜單的功能表項目

如何刪除右鍵快顯功能表裡的項目?

以Windows XP(SP2)為例,有些右鍵菜單中的選項你並不常用,或者有些軟體已被刪除,但其仍然佔據著右鍵菜單。要刪除這些無用的右鍵功能表項目,操作步驟如下

運行regedit開啟登錄編輯程式。展開[HKEY_CLASSES_ROOT//*//shellex//ContextMenuHandlers]分支,找到要刪除的無用項,然後根據關鍵字刪除需要清除的右鍵功能表項目即可。對於僅在檔案夾右鍵菜單中才有的選項,可到[HKEY_CLASSES_ROOT//Direclory//shell]和[HKEY_CLASSES_ROOT//Directory//shellex//ContextMenuHandlers]分支下尋找。有時[IHKEY_CLASSES_ROOT//Folder//shell]和[HKEY_CLASSES_ROOT//Folder//shellex//ContextMenuHandlers]分支下也有右鍵菜單中的選項。最好使用按鍵組合“Ctrl+F”,在尋找對話方塊中輸入要刪除的菜單中的關鍵字,找到後刪除即可。 經過以上操作,右鍵菜單清爽多了吧!
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.