这个功能在windows上测试安装卸载时,有时会用到,网上查到的两种语言的版本如下:
C#版:
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;
VB版:
Public Shared Function LockApp(isLock As Boolean, appPath As String) As Boolean
Dim shell As New Shell()
Dim folder As Folder = shell.[NameSpace](Path.GetDirectoryName(appPath))
Dim app As FolderItem = folder.ParseName(Path.GetFileName(appPath))
Dim sVerb As String = If(isLock, "锁定(&K)", "脱离(&K)")
For Each Fib As FolderItemVerb In app.Ver