Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,

i am building an application in MFC, i am having an application which sets the privileges to the windows user.So in this i have to disable or enable Copy,Cut,Paste,delete options in windows.I was successfull in restricting the user doing copy.cut,paste and delete using keyboard in the windows(i have done it by using Hooks).But the user was still able to copy,cut,paste and delete through mouse by right clicking on any file or in the windows.

Actually i want to disable copy,cut,paste,delete of files and folder using my application.When the user right clicks on any file or folder those options should be disable

Is this done by setting some value name in the registry and setting the value as 0 or 1.(If yes can you just tell me whats the registry key and the value name for the same)

Or is there any other way to do it.Kindly help me for this.I will thankful for you.

Thanks in Advance
Posted
Updated 2-Nov-12 0:06am
v2
Comments
YvesDaoust 2-Nov-12 5:41am    
Your question is confusing. Do you want to disable clipboard operation for the Windows GUI (Windows Explorer for instance) or for your application window(s) ? In the second case, what kind of widget ?
Rocky_Bas 2-Nov-12 5:58am    
I want disable those options when the user right clicks in the system,not in my application.
Jochen Arndt 2-Nov-12 6:03am    
As noted in my comment below:
Update your question to make this clear.
Jochen Arndt 2-Nov-12 6:01am    
You already asked something similar and got a lot of answers and comments: http://www.codeproject.com/Questions/465653/How-to-Disable-Enable-copy-cut-paste-in-the-regist

At least you should be more clear here:
You want to disable these operations for Windows and all running applications!
And the common answer is:
A very bad idea (e.g. when trying to edit text without the delete key).

I don't think that there are registry keys for this. Even if there are keys, changing them often require a reboot to take effect.

What you can do is disabling specifiy keys by using the registry. See http://support.microsoft.com/kb/216893 for an example disabling the Windows key. Note that this requires a reboot.
Rocky_Bas 2-Nov-12 6:04am    
Actually i want to disable copy,cut,paste,delete of files and folder using my application.When the user right clicks on any file or folder those options should be disabled.

1 solution

If you want to disable over all context menu when right button is clicked?
If yes in my openinon you can use PreTranslateMessage.
his Function filter window messages before they are dispatched to the Windows functions.
C++
BOOL PreTranslateMessage( MSG* pMsg_i )
 {
    try
    {
        switch( pMsg_i->message )
        {
            case WM_KEYDOWN:
            {
                UINT nKeyCode = pMsg_i->wParam;

                // Prevent Ctrl+C(Copy) and Ctrl+V(Paste) shortcut.
                SHORT sCtrlKeyState = ::GetKeyState( VK_CONTROL );
                if(( _T( 'C' ) == nKeyCode || _T( 'V' ) == nKeyCode ) &&
                   ( 0 > sCtrlKeyState ))
                {
                    return TRUE;
                }
                break;
            }
            case WM_CONTEXTMENU:
            case WM_RBUTTONDOWN:
            {
                return TRUE;
            }
            default:
            {
                break;
            }
        }
    }
    catch( ... )
    {
        throw;
    }
 }

so when user try to double click this function just retuen true.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900