The Xceed Zip Compression Library ActiveX control supports both the Single-Threaded Apartment model (STA) and the Multi-Threaded Apartment model (MTA). The entire library's code is threadsafe, can be instantiated multiple times in order to perform multiple zip file manipulation operations at the same time, and is designed to use very little memory per instance – so your machine won't run out of memory when you're running dozens of instances at the same time.
The library also supports background processing. Background processing is a different concept than running multiple instances simultaneously. See the background processing property topic for details.
Yes, two small restrictions. First: two or more instances may not add files to, or create the same zip file located in the same folder. Second: each instance of the Xceed Zip control can only execute one process at a time. This makes sense, because if it was possible for a single instance to run more than one operation at a time, you would get the same event from two processes and wouldn't know for which process you are getting the event. Running multiple simultaneous operations involves having multiple instances, with each instance running its own operation.
If you're using forms in your application, you can place multiple Xceed Zip control objects on your form, call them XceedZip1, XceedZip2, XceedZip3, etc. Each control on the form is a separate instance of the library. Therefore, each instance's methods can be called simultaneously and can each process at the same time.
For example, place 4 Xceed Zip controls on a form, with 4 buttons, and 4 progress bars. For the click event of Button1, add code to zip up a file that referring to the XceedZip1 control. Set Button1's caption to the return value so you can know when it finished. In the XceedZip1 control's GlobalStatus event, set ProgressBar1's value to the nBytesPercent parameter provided to you by the GlobalStatus event. Do this 4 times, changing Button1 for Button2, XceedZip1 for XceedZip2, and ProgressBar1 for ProgressBar2. Make sure each button works on a different zip file! Now run your program, and click on each button one after the other. If you are zipping up enough files, each progress bar should be moving along at its own pace.
If you're using code, it's pretty much the same concept: Instantiate the control multiple times and instruct each instance to do whatever you want it to. In VB, to create multiple instances of the control, you can do this (this example can be generalized to more objects to n by using arrays):
Visual Basic | Copy Code |
---|---|
|