I'm trying to do an app which tells me the total times of all videos. Its not practical it's only a practice to improve my coding abilities :)
In this line is the error
Shell32.Shell shell = new Shell32.Shell();
And this is the error
Unable to cast COM object of type 'System .__ ComObject' to interface type 'Shell32.Shell'. There was an error in operation because the QueryInterface call on the COM component for the interface with IID '{} 286E6F1B-7113-4355-9562-96B7E9D64C54' generated the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE) ).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Shell32;
namespace cuentavideosconsola
{
class Program
{
static void Main(string[] args)
{
double contartiempo = 0;
Shell32.Shell shell = new Shell32.Shell();
Shell32.Folder carpeta;
carpeta = shell.NameSpace(@"D:\");
foreach(Shell32.FolderItem2 item in carpeta.Items()){
Console.WriteLine(carpeta.GetDetailsOf(item,27));
TimeSpan tiempo = TimeSpan.Parse(carpeta.GetDetailsOf(item,27));
contartiempo += tiempo.TotalSeconds;
}
Console.WriteLine("El total de tiempo de los videos es: " + contartiempo);
Console.ReadLine();
}
}
}