Hello. I'm trying to create a software in VB.Net to disable the following from a Windows 7 pc.


- Cut, copy, paste, rename, delete, open, print, share, create shortcut, open with, send to, properties.


I want to give users the option of disabling them selectively/individually via checkboxes so those options will be disabled in the right-click of a mouse.


I'm aware that to do so I must disable them from the Windows registry.


My problem is I don't know which is the right key to disable as the registry is so huge & some keys are similiarly named.


Could anyone help me to say what are the exact key locations of the above-mentioned right-click functions in the Windows Registry ?


I'd be deeply grateful. Thank you.

Dani AI

Generated

what you are trying to toggle are mostly Explorer’s built‑in verbs. There is no per‑verb registry switch for cut/copy/paste/rename/delete/open/print/create shortcut, etc. You can either hide the whole Explorer context menu, or remove specific shell extensions like Send to. Group Policy exposes “Remove File Explorer’s default context menu,” which writes HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoViewContextMenu=1. That hides the right‑click menu in Explorer and on the desktop, but it does not block users from doing the same actions via the keyboard or other UI. See Microsoft’s description for details. Remove File Explorer’s default context menu. Also documented with the exact registry path here: Windows security encyclopedia entry.

To remove only “Send to,” blank its handler registration (per‑user) by setting the default value to an empty string:

Imports Microsoft.Win32

' Hide all context menus in Explorer (per-user)
Sub SetNoViewContextMenu(enable As Boolean)
    Using k = Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")
        k.SetValue("NoViewContextMenu", If(enable, 1, 0), RegistryValueKind.DWord)
    End Using
End Sub

' Show/hide "Send to" (per-user)
Sub SetSendToVisible(visible As Boolean)
    Dim p = "Software\Classes\AllFilesystemObjects\shellex\ContextMenuHandlers\Send To"
    Using k = Registry.CurrentUser.CreateSubKey(p)
        k.SetValue("", If(visible, "{7BA4C740-9E81-11CF-99D3-00AA004AE837}", ""), RegistryValueKind.String)
    End Using
End Sub

If you need to clean up “Open with,” there is no global off switch, but you can exclude specific apps by adding an empty string value named NoOpenWith under HKCR\Applications\YourApp.exe, and you can prune per‑extension lists under HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.ext. Exclude an app from Open with. For restoring/hiding “Send to,” Microsoft Q&A confirms the same GUID/location. Send To option missing.

Tip: changes usually apply after restarting Explorer or signing out/in. And as said, test on a VM first.

Recommended Answers

All 2 Replies

If you want to prevent user to doing something you usually can achieve that with (local) group policy objects. You edit LGPOs with Group Policy Editor, but GPOs in fact modify your registry just like you thought.

You can available Group Policy settings and check if you find those settings you want to disable. Downloadable Excel files also show which registry key will be modified (if I remember right). And those are the registry keys your .NET app will modify.

A word of caution: do NOT test registry modifications in your machine. Get a separate test machine or better yet, use a virtual Win7 machine for testing purposes. A messed up registry is definitely something you don't want to have in your (only) machine :D Good luck!

HTH

Thank you. I really appreciate this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.