Bug :Was not able extract any zip files( WinZip 14.5 ) through Window service application ( which was using WinZip 14.5 command line )
Description: An Information found in Event logger – System as
Application popup: wzunzip.exe - Application Error : The application failed to initialize properly (0xc0000142). Click on OK to terminate the application.
Resolved :
This can be resolved just setting up the property of your application window service as below .
By check – Allow service to interact with desktop , it is said to service allow popup windows but by default service will run in hidden / silent mode . So nothing to worry about the popup .
Using Winzip14.5 command line – wzunzip.exe
Code snippet, I used in my application testing .
using System; using System.Collections.Generic; using System.Text; using System.IO; namespace UnZipTest { public class UnZip { public void Run (string path,string extractPath){ DirectoryInfo dirInfo = new DirectoryInfo(path); System.Diagnostics.Process P = new System.Diagnostics.Process(); if(Directory.Exists(extractPath)==false){ Directory.CreateDirectory(extractPath); } string UnZipCmd = null; foreach(FileInfo fl in dirInfo.GetFiles("*.zip")){ try { string password = "123"; string zipExtract = extractPath + "\\" + fl.Name + "_" + Guid.NewGuid().ToString().Substring(0, 4); if (password.Trim().Length == 0) { UnZipCmd = string.Format("-o \"{0}\" \"{1}\"", fl.FullName, zipExtract); P = System.Diagnostics.Process.Start(@"C:\Program Files\WinZip\wzunzip", UnZipCmd); } else{ UnZipCmd = string.Format("-s\"{0}\" -o \"{1}\" \"{2}\"",password, fl.FullName, zipExtract); P = System.Diagnostics.Process.Start(@"C:\Program Files\WinZip\wzunzip", UnZipCmd); } P.WaitForExit(); } catch (Exception ex){ throw ex; } } } } }
No comments:
Post a Comment