您的位置:首页 > 编程语言 > C#

C#将程序锁定到Windows7任务栏

2012-07-16 13:03 615 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Shell32;
using System.IO;

namespace TestWin7Taskbar
{
class Win7Taskbar
{
public static bool LockApp(bool isLock, string appPath)
{
Shell shell = new Shell();
Folder folder = shell.NameSpace(Path.GetDirectoryName(appPath));
FolderItem app = folder.ParseName(Path.GetFileName(appPath));
string sVerb = isLock ? "锁定到任务栏(&K)" : "从任务栏脱离(&K)";

foreach (FolderItemVerb Fib in app.Verbs())
{
if (Fib.Name == sVerb)
{
Fib.DoIt();
return true;
}
}

return false;

}
}
}


Win7Taskbar.LockApp(true, appPath)

Win7Taskbar.LockApp(falase, appPath
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: