有人可以向我解释下面的代码行是做什么的吗?
dynamic shellApplication = Activator.CreateInstance(Type.GetTypeFromProgID("Shell.Application"));
string path = System.IO.Path.GetDirectoryName(filePath);
string fileName = System.IO.Path.GetFileName(filePath);
dynamic directory = shellApplication.NameSpace(path);
dynamic link = directory.ParseName(fileName);
dynamic verbs = link.Verbs();
Run Code Online (Sandbox Code Playgroud)
我搜索了msdn库,但无法真正理解它的作用.
这不是完整的代码,但我承诺其余的,只是这部分我正在努力.
看起来它正在检索与特定程序关联的 shell 操作。例如打开、打印、编辑等。
打开 regedit 并导航到 HKEY_LOCAL_MACHINE\SOFTWARE\Classes\textfile
展开它并查看 Shell 键。代码应该返回与此类似的动词。