how to: pin or unpin from win7 taskbar in C#

            Shell32.Shell shell = new ShellClass();
            Folder folder = shell.NameSpace(@"C:\Windows\") as Folder;
            FolderItem folderItem = folder.ParseName("regedit.exe");
            FolderItemVerbs vs = folderItem.Verbs();

            for (int i = 0; i < vs.Count; i++)
            {
                FolderItemVerb ib = vs.Item(i);
                if (ib.Name.Replace("&", "") == "Pin to Taskbar")
                {
                    Console.WriteLine(ib.Name);
                    ib.DoIt();
                }
            }
 
yeah! right click on .exe and just execute the right menu! resouce name can be found in shell32 or something else.
COM name is Microsoft Shell and Application 1.0
原文在这里, 是可以拿C#做的, 不必非要运行一个脚本。 

http://blog.ananthonline.net/?p=37

posted on 2010-05-26 14:41  无法显示此网页  阅读(758)  评论(0编辑  收藏  举报

导航