问题描述
HI,
我正在MFC中构建应用程序,我正在为Windows用户设置权限的应用程序,因此在此我必须禁用或启用Windows中的复制,剪切,粘贴,删除选项.我成功地限制了用户的操作在Windows中使用键盘进行复制,剪切,粘贴和删除操作(我已经使用Hooks完成了此操作).但是,用户仍然可以通过右键单击任何文件或在窗口中使用鼠标来复制,剪切,粘贴和删除操作. br/>
实际上,我想使用我的应用程序禁用对文件和文件夹的复制,剪切,粘贴,删除.当用户右键单击任何文件或文件夹时,这些选项应被禁用
通过在注册表中设置一些值名称并将值设置为0或1来完成此操作吗(如果可以,请告诉我相同的注册表项和值名称)
还是有其他方法可以解决.请帮我.感谢您.
在此先感谢
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
推荐答案
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.
这篇关于如何禁用窗口中的一些右键单击选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!