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
本文介绍了一个简单的C#程序,用于将指定的应用程序锁定或解锁到Windows 7任务栏。通过调用Shell32库,程序可以实现对任务栏的定制功能。
318

被折叠的 条评论
为什么被折叠?



