views:

74

answers:

6
int sysReturn = system("\"C:\\Program Files\\WinZip\\winzip32\" -a C:\\LOG\\test.zip C:\\LOG\\LOG_7-20-2010_17_8_48_834.csv");  

Everything seems to work - as in it creates test.zip
However, it opens the WinZip GUI (that shows how much has been compressed, etc while my program is running.)

How can I skip that part where it doesn't open anything in windows that the user sees? I would like it to be "hidden" so after my program runs, all you see is the zipped file.

WinZip command line parameters reference:
http://www.memecode.com/docs/winzip.html

+3  A: 

Your code is very wrong.

To create .zip files, you should use a native .zip library in C++.

Here are some free ones:

SLaks
+3  A: 

How about stop using the winzip executable from your c++ code and use a library instead? For your code to ever have any hope of working on a different system, you can't rely on 3rd party executables being around.

Have a look at this: http://stackoverflow.com/questions/262899/portable-zip-library-for-c-c-not-an-application

Salgar
+1  A: 

Can you use 7-zip? It is free (LGPL license) and can be run from the command line without creating a window.

zdan
+2  A: 

I'd agree with the other's answers about using a different utility. However, to answer your question: the link that you posted also mentions another option -min to run WinZip minimized. Did you try that? Also, instead of using system, try using ShellExecute and ask for the window to be hidden:

ShellExecute(NULL, NULL, "C:\\Program Files\\WinZip\\winzip32", "-a C:\\LOG\\test.zip C:\\LOG\\LOG_7-20-2010_17_8_48_834.csv", NULL, SW_HIDE);
casablanca
Is there a way to hide the confirmation box without checking "do not display again"? this does hide the WinZip GUI but not the confirm box that shows the stats of the compression with the OK button.
Tommy
I'm afraid that's not possible, unless there's a command-line option to disable that.
casablanca
+1  A: 

Try using execlp instead. The few times i've had to do it i had better luck with it over System.

execlp("explorer", "/n, /select,c:\\foo.txt", 0)

See this MSDN page for a detailed example: http://msdn.microsoft.com/en-us/library/431x4c1w.aspx

Caladain
+2  A: 

You want this:

http://www.winzip.com/prodpagecl.htm

Arkadiy
Or this, which is free: http://www.izarc.org/izarccl.html (but the Right Way is to use a library)
Matteo Italia