Access denied when closing folder using SHDocVw

66 views Asked by At

I try to close a folder by its path using SHDocVw. It's not working:

Acces deined.

I run my program as an administrator.

ShellWindows _shellWindows = new SHDocVw.ShellWindows();
string processType;
foreach (InternetExplorer ie in _shellWindows)
{
    processType = Path.GetFileNameWithoutExtension(ie.FullName).ToLower();
    if (processType.Equals("explorer") && ie.LocationURL.Contains(mypath))
    {
        ie.Quit();
    }
}
0

There are 0 answers