错误HRESULT E_FAIL在使用Shell32时从调用COM组件错误返回

时间:2018-05-18 07:19:23

标签: c# .net

public static void UnZip(object param)
{
    object[] args = (object[])param;
    string zipFile = (string)args[0];
    string folderPath = (string)args[1];


    if (!File.Exists(zipFile))
        throw new FileNotFoundException();

    if (!Directory.Exists(folderPath))
    Directory.CreateDirectory(folderPath);

    Shell32.Shell objShell = new Shell32.Shell();
    Shell32.Folder destinationFolder = objShell.NameSpace(folderPath);
    Shell32.Folder sourceFile = objShell.NameSpace(zipFile);

    foreach (var file in sourceFile.Items())
    {
        destinationFolder.CopyHere(file, 4 | 16);
    }
}

尝试解压缩文件夹并将其保存在目标Shell32.Folder sourceFile = objShell.NameSpace(zipFile);给出错误。有人可以帮忙吗?

0 个答案:

没有答案