你如何获得快捷方式文件夹的目录目标?我到处搜索,只找到快捷方式文件的目标.
我使用以下代码来引用shell DLL
Type t = Type.GetTypeFromProgID("Shell.Application");
Shell s = (Shell)Activator.CreateInstance(t);
Console.WriteLine("success");
Console.ReadLine();
Run Code Online (Sandbox Code Playgroud)
它在我的Windows 7开发机器上工作正常.但是当我尝试在Win 2003服务器上运行exe时,我得到了这个异常
Unable to cast COM object of type 'System.__ComObject' to interface type 'Shell3
2.Shell'. This operation failed because the QueryInterface call on the COM compo
nent for the interface with IID '{866738B9-6CF2-4DE8-8767-F794EBE74F4E}' failed
due to the following error: No such interface supported (Exception from HRESULT:
0x80004002 (E_NOINTERFACE)).
Run Code Online (Sandbox Code Playgroud)
我从C#中获得了一些帮助:引用了一个Windows shell界面,但没有运气.
我使用Microsoft Shell控件和自动化引用引用shell,这是Interop.Shell32 dll
如果有人可以指导,那将非常有帮助.
这是可能的,但在Windows服务中使用SHFileOperation是否合适?shell32.dll中的所有SHxxx API函数似乎都是用用户级程序编写的.我可以确定SHFileOperation不会显示GUI吗?