Today I want to study the MP3 and then use the following code when outputting the MP3 length (online):
string file = "D:\\accountdaemon\\my Music\\mymusics\\luxtos.mp3"; Shellclass sh = new Shellclass (); Folder dir = sh. NameSpace (path.getdirectoryname (file)); FolderItem item = dir. ParseName (path.getfilename (file)); String str = dir. Getdetailsof (item, 27); Gets the length of the song. Console.WriteLine (str);
And then there's this:
Unhandled exception: System.InvalidCastException: Could not cast COM object of type "Shell32.shellclass" to Interface type "Shell32.ishelldispatch6". This operation failed because the COM component call to the interface with IID ' {286e6f1b-7113-4355-9562-96b7e9d64c54} ' QueryInterface failed with the following error: This interface is not supported (exception is from hresult:0 x80004002 (E_nointerface)).
This is because the VS comes with the Interop.Shell32.dll version is 1.0 too old, so found on the Internet 1.2 version, and then changed to reference 1.2 version. Then change the embedded interop type inside the reference attribute to False.
DLL's: http://download.csdn.net/detail/u013529927/8812075
Unable to cast COM object of type "Shell32.shellclass" to Interface type "Shell32.ishelldispatch 6"