次のコードを使用してシェル dll を参照しています
Type t = Type.GetTypeFromProgID("Shell.Application");
Shell s = (Shell)Activator.CreateInstance(t);
Console.WriteLine("success");
Console.ReadLine();
私の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)).
私はC# の助けを借りました: Windows シェル インターフェイスを参照していますが、うまくいきませんでした。
Interop.Shell32 dll である Microsoft Shell Controls および Automation リファレンスを使用してシェルを参照しています
誰かがそれを導くことができれば、それは本当に役に立ちます。