Home Forums ActiveX components Xceed Zip for ActiveX & x64 xceedCompressionClass compress returns xceSuccess but does not compress

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • ravi.s
    Participant
    Post count: 1
    #43758 |

    hi,

    I am using Xceedzip.dll COM Component 4.2 for in-memory compression (and I am referring to this documentation).

    XceedCompression ^compression = gcnew XceedCompressionClass();
    		compression->License("My License Key!");
    
    		xcdCompressionError r_error;
    		VARIANT r_dataToCompress;
    		VARIANT r_compressedData;
    		VARIANT r_uncompressedData;
    		SAFEARRAY *r_safeArray;
    		char *r_safeArrayData;
    		size_t r_length;
    
    		r_length = strlen(loginRequestData);
    		r_safeArray = SafeArrayCreateVector(VT_I1, 0, r_length);
    
    		SafeArrayAccessData(r_safeArray, (void**)&r_safeArrayData);
    		CopyMemory(r_safeArrayData, loginRequestData, r_length);
    		SafeArrayUnaccessData(r_safeArray);
    
    		VariantInit(&r_dataToCompress);
    		VariantInit(&r_compressedData);
    		VariantInit(&r_uncompressedData);
    
    		r_dataToCompress.vt = VT_ARRAY | VT_I1;
    		r_dataToCompress.parray = r_safeArray;
    
    		//r_compressedData.vt = VT_ARRAY | VT_I1;
    		//r_compressedData.parray = r_safeArray;
    
    		IntPtr r_intPtrDataToCompress = (IntPtr)&r_dataToCompress;
    		Object ^r_dataToCompressObject = Marshal::GetObjectForNativeVariant(r_intPtrDataToCompress);
    
    		IntPtr r_intPtrCompressedData = (IntPtr)&r_compressedData;
    		Object ^r_CompressedDataObject = Marshal::GetObjectForNativeVariant(r_intPtrCompressedData);
    
    		r_error = compression->Compress(r_dataToCompressObject, r_CompressedDataObject, VARIANT_TRUE);
    		//VariantClear(&r_dataToCompress);
    		if (r_error != xcdCompressionError::xceSuccess)
    			Console::WriteLine("Error Encountered!");
    
    		if (r_CompressedDataObject != NULL) {
    			PrintByteArrayVariant< unsigned char >(&r_compressedData);
    		
    		} else {
    			Console::WriteLine("compressed Data Object NULL !");
    		}
    		
    }
    
    template< class DataType > static void PrintByteArrayVariant(VARIANT * variant)
    {
    	DataType * data;
    	SAFEARRAY * arrayDescriptor;
    	int i, count;
    
    	// Get the array descriptor from the variant
    	arrayDescriptor = variant->parray;
    
    	// Gain access to the array data
    	SafeArrayAccessData(arrayDescriptor, (void **)&data);
    
    	// Get the number of elements in the first dimension of the array
    	count = arrayDescriptor->rgsabound[0].cElements / sizeof(DataType);
    
    	int lineThreshold = 32 / sizeof(DataType);
    	int groupThreshold = 4 / sizeof(DataType);
    	char buffer[16];
    
    	sprintf(buffer, "%%0%dX", sizeof(DataType) * 2);
    
    	for (i = 0; i < count; i++)
    	{
    		// If we need to change line
    		if ((i % lineThreshold) == 0 && i > 0)
    			printf("\n");
    
    		// If we need to seperate a group of data
    		if ((i % groupThreshold) == 0)
    			printf(" ");
    
    		// Access the current index as we would a normal array
    		printf(buffer, data[i]);
    	}
    
    	// Release access to the array data
    	SafeArrayUnaccessData(arrayDescriptor);
    }
    

    The return value of the compress method is xceSuccess , but r_compressedData is empty .
    Any idea about what might be wrong ? I had a hunch that the key for the library might have expired , but since I get xceSuccess as the return value I doubt that might be the case .

    alexau
    Participant
    Post count: 1

    you have mistake in letter which you wrote, sorry but i dont have time to check it i will do it later but you sould do it too

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.