显示/隐藏任务栏,屏蔽任务管理器(winform)

 

ContractedBlock.gif ExpandedBlockStart.gif Code
 1//引入命名控件:
 2using Microsoft.Win32;
 3using System.Runtime.InteropServices;
 4
 5[DllImport("user32.dll", EntryPoint = "FindWindowA")]
 6public static extern IntPtr FindWindowA(string lp1, string lp2);//获取任务栏
 7
 8[DllImport("user32.dll", EntryPoint = "ShowWindow")]
 9public static extern IntPtr ShowWindow(IntPtr hWnd, int _value);//显示/隐藏任务栏
10
11ExpandedBlockStart.gifContractedBlock.gif/**//// <summary>
12/// 是否屏蔽CTRL+ALT+DEL
13/// </summary>
14/// <param name="i">1=屏蔽 0=取消屏蔽</param>

15public static void ShieldMissionTask(int i)
16ExpandedBlockStart.gifContractedBlock.gif{
17try
18ExpandedSubBlockStart.gifContractedSubBlock.gif{
19//屏蔽 Ctrl + Alt + Del 键
20RegistryKey key = Registry.CurrentUser;
21RegistryKey key1 = key.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");
22                key1.SetValue("DisableTaskMgr", i, Microsoft.Win32.RegistryValueKind.DWord);
23}

24catch (Exception ex)
25ExpandedSubBlockStart.gifContractedSubBlock.gif{
26throw ex;
27}

28}

29
30ExpandedBlockStart.gifContractedBlock.gif/**//// <summary>
31/// 是否显示任务栏
32/// </summary>
33/// <param name="i">5=显示 0=隐藏</param>

34public static void ShieldTaskBar(int i)
35ExpandedBlockStart.gifContractedBlock.gif{
36try
37ExpandedSubBlockStart.gifContractedSubBlock.gif{
38IntPtr hTray = FindWindowA("Shell_TrayWnd", String.Empty); //获取任务栏
39ShowWindow(hTray, i);    //隐藏任务栏
40}

41catch (Exception ex)
42ExpandedSubBlockStart.gifContractedSubBlock.gif{
43throw ex;
44}

45}

转载于:https://www.cnblogs.com/gossip/archive/2008/10/17/1313228.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值