C# WinLockDll.dll屏蔽快捷键

 [DllImport("WinLockDll.dll", CallingConvention = CallingConvention.StdCall)]
        public static extern int CtrlAltDel_Enable_Disable(bool bEnableDisable);

        [DllImport("WinLockDll.dll", CallingConvention = CallingConvention.StdCall)]
        public static extern int AltTab1_Enable_Disable(bool bEnableDisable);

        [DllImport("WinLockDll.dll", CallingConvention = CallingConvention.StdCall)]
        public static extern int StartButton_Show_Hide(bool bShowHide);

        [DllImport("WinLockDll.dll", CallingConvention = CallingConvention.StdCall)]
        public static extern int Taskbar_Show_Hide(bool bShowHide);

        [DllImport("WinLockDll.dll", CallingConvention = CallingConvention.StdCall)]
        public static extern int Clock_Show_Hide(bool bShowHide);

        [DllImport("WinLockDll.dll", CallingConvention = CallingConvention.StdCall)]
        public static extern int TaskSwitching_Enable_Disable(bool bEnableDisable);

        [DllImport("WinLockDll.dll", CallingConvention = CallingConvention.StdCall)]
        public static extern int TaskManager_Enable_Disable(bool bEnableDisable);

        [DllImport("WinLockDll.dll", CallingConvention = CallingConvention.StdCall)]
        public static extern int Keys_Enable_Disable(bool bEnableDisable);

        [DllImport("user32.dll")]
        public static extern void BlockInput(bool Block);
   private void Lock()
        {
            CtrlAltDel_Enable_Disable(false);
            AltTab1_Enable_Disable(false);
            StartButton_Show_Hide(false);
            Taskbar_Show_Hide(false);
            Clock_Show_Hide(false);
            TaskSwitching_Enable_Disable(false);
            TaskManager_Enable_Disable(false);
            Keys_Enable_Disable(false);
            BlockInput(true);
        }


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
C#中使用OpcComRcw.dll,需要进行以下步骤: 1. 添加对OpcComRcw.dll的引用。在Visual Studio中,打开项目,右键单击“引用”文件夹,选择“添加引用”,在“COM”选项卡中找到并选择OpcComRcw.dll。 2. 在代码文件中添加命名空间引用。在代码文件的顶部添加以下命名空间引用: using OpcRcw.Da; using OpcRcw.Comn; 3. 创建并配置OPC服务器连接。使用以下代码创建并配置OPC服务器连接: private static IOPCServer opcServer; private static IOPCBrowseServerAddressSpace browser; Guid iid = typeof(IOPCServer).GUID; Type type = Type.GetTypeFromCLSID(iid); opcServer = (IOPCServer)Activator.CreateInstance(type); iid = typeof(IOPCBrowseServerAddressSpace).GUID; type = Type.GetTypeFromCLSID(iid); browser = (IOPCBrowseServerAddressSpace)Activator.CreateInstance(type); browser.Connect("localhost"); 4. 浏览和选择OPC项。使用以下代码浏览和选择OPC项: OPCITEMDEF[] itemDefs = new OPCITEMDEF[1]; itemDefs[0] = new OPCITEMDEF(); itemDefs[0].szAccessPath = ""; itemDefs[0].szItemID = "Random.Int1"; itemDefs[0].bActive = 1; itemDefs[0].hClient = 1; OPCITEMRESULT[] itemResults; opcServer.AddItems(1, itemDefs, out itemResults); 5. 读取和写入OPC项的值。使用以下代码读取和写入OPC项的值: OPCITEMSTATE[] itemStates; opcServer.Read(OPCDATASOURCE.OPC_DS_DEVICE, 1, itemResults[0].hServer, out itemStates); object value = 12345; opcServer.Write(1, new int[] { itemResults[0].hServer }, new object[] { value }, out errors); 以上是使用C# OpcComRcw.dll进行OPC通信的基本步骤。可以根据具体需求进行更多的操作和定制。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值