我的Windows应用程序中有一些疑问 [英] I had Some doubt in my Windows app
本文介绍了我的Windows应用程序中有一些疑问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
避免拖拽&使用C#编程放入Windows 7资源管理器......
请帮助我一位先生/女士吧......
解决方案
创建DWORD(32位)DefaultDropEffect
value =4 - 创建Shorcut进行拖放
value =0 - 正常
HKEY_CLASSES_ROOT / * / DefaultDropEffect
C#用于鼠标拖放的创建快捷方式链接代码
CreateShortCut(4); //函数Cll
#region拖放
< span class =code-keyword> private void CreateShortCut( int iAction)
{
RegistryKey registryKey = Registry.ClassesRoot.CreateSubKey( *);
if (registryKey == null )
{
throw new 异常( CreateSubKey失败);
}
if (iAction!= 0 )
{
registryKey.SetValue( DefaultDropEffect,iAction,RegistryValueKind.DWord);
}
else
{
registryKey.DeleteValue( DefaultDropEffect, false );
}
registryKey.Close();
registryKey = Registry.ClassesRoot.CreateSubKey( AllFilesystemObjects);
if (registryKey == null )
{
throw new 异常( CreateSubKey失败(AllFilesystemObjects));
}
if (iAction!= 0 )
{
registryKey.SetValue( DefaultDropEffect,iAction,RegistryValueKind.DWord);
}
else
{
registryKey.DeleteValue( DefaultDropEffect, false );
}
}
#endregion
Avoid Drag & Drop in Windows 7 Explorer using C# programming......
Please some one Help me sir/madam..
解决方案
Create DWORD(32-bit) "DefaultDropEffect"
value="4" - create Shorcut for drag and drop
value="0" - normal
HKEY_CLASSES_ROOT/*/DefaultDropEffect
C# Code for creat shortcut link for mouse drag and drop
CreateShortCut(4); // Function Cll
#region "Drag And Drop" private void CreateShortCut(int iAction) { RegistryKey registryKey = Registry.ClassesRoot.CreateSubKey("*"); if (registryKey == null) { throw new Exception("CreateSubKey failed"); } if (iAction != 0) { registryKey.SetValue("DefaultDropEffect", iAction, RegistryValueKind.DWord); } else { registryKey.DeleteValue("DefaultDropEffect", false); } registryKey.Close(); registryKey = Registry.ClassesRoot.CreateSubKey("AllFilesystemObjects"); if (registryKey == null) { throw new Exception("CreateSubKey failed (AllFilesystemObjects)"); } if (iAction != 0) { registryKey.SetValue("DefaultDropEffect", iAction, RegistryValueKind.DWord); } else { registryKey.DeleteValue("DefaultDropEffect", false); } } #endregion
这篇关于我的Windows应用程序中有一些疑问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文