Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting A Reference To A Shell32 File Object
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Getting A Reference To A Shell32 File Object
Miscellaneous
Thread ID:
01249736
Message ID:
01249736
Views:
74
I'm trying to add a file to a ZIP archive using C#. I'm getting "The system cannot find the file specified" on the 'oFile' line. I know that line isn't quite right. Can someone help?

Thanks
static void AddFileToArchive(string sArchive, string sFileToAdd)
{
    const int HIDE_ERRORS = 1024;

    // Create an instance of the Shel32 class
    Shell32.ShellClass oShell = new Shell32.ShellClass();

    // Get a reference to the archive file
    Shell32.Folder oArchiveFolder = oShell.NameSpace(sArchive);

    // Get a reference to the file
    Shell32.Folder oFile = oShell.NameSpace(sFileToAdd);

    // Set up the CopyHere options
    int iFlags = HIDE_ERRORS;

    // Copy the items in the folder to the archive
    oArchiveFolder.CopyHere((Shell32.FolderItems3)oFile, 1024);

    // Wait a second and give the zipping thread time to get started
    System.Threading.Thread.Sleep(1000);
}
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Reply
Map
View

Click here to load this message in the networking platform