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); }