// This sample encodes data entirely in memory with the UUEncode format
// This code uses the #import directive.
// Put the following line at the beginning of your module
#import "XCEEDBEN.DLL" no_namespace named_guids
CoInitialize( NULL );
try
{
IXceedBinaryEncodingPtr piBinEncoder;
piBinEncoder.CreateInstance( CLSID_XceedBinaryEncoding );
piBinEncoder->License( _bstr_t( L"your license key ) );
IXceedUUEncodingFormatPtr piUUEncode;
piUUEncode.CreateInstance( CLSID_XceedUUEncodingFormat );
piUUEncode->IncludeHeaderFooter = FALSE;
piBinEncoder->EncodingFormat = IXceedEncodeDataPtr( piUUEncode );
char* pcSource = "This is the data to encode";
BYTE* pcEncoded = NULL;
DWORD dwEncodedSize;
piBinEncoder->Encode( ( BYTE* )pcSource, lstrlen( pcSource ), TRUE,
&pcEncoded, &dwEncodedSize );
MessageBox( NULL, "Encoding successful!", "Encoding result", MB_OK );
CoTaskMemFree( pcEncoded );
}
catch( const _com_error& xErr )
{
char szMsg[250];
wsprintf( szMsg, "Error %08x\n%s", xErr.Error(),(char*)xErr.Description() );
MessageBox( NULL, szMsg, "Error", MB_OK );
}
catch( ... )
{
MessageBox( NULL, "Unknown error", "Error", MB_OK );
}
CoUninitialize();
// This sample decodes data entirely in memory with the UUEncode format
// This code uses the #import directive.
// Put the following line at the beginning of your module
#import "XCEEDBEN.DLL" no_namespace named_guids
CoInitialize( NULL );
try
{
IXceedBinaryEncodingPtr piBinEncoder;
piBinEncoder.CreateInstance( CLSID_XceedBinaryEncoding );
piBinEncoder->License( _bstr_t( L"your license key ) );
IXceedUUEncodingFormatPtr piUUEncode;
piUUEncode.CreateInstance( CLSID_XceedUUEncodingFormat );
piUUEncode->IncludeHeaderFooter = FALSE;
piBinEncoder->EncodingFormat = IXceedEncodeDataPtr( piUUEncode );
BYTE* pcDecoded = NULL;
DWORD dwDecodedSize;
//"This is the encoded data"
char* pcEncoded = "85&AI<R!I<R!T:&4@96YC;V1E9\"!D871A";
piBinEncoder->Decode( ( BYTE* )pcEncoded, lstrlen( pcEncoded ), TRUE, &pcDecoded,
&dwDecodedSize );
MessageBox( NULL, "Decoding successful!", "Decoding result", MB_OK );
CoTaskMemFree( pcDecoded );
}
catch( const _com_error& xErr )
{
char szMsg[50];
wsprintf( szMsg, "Error %08x\n", xErr.Error() );
MessageBox( NULL, szMsg, "Error", MB_OK );
}
catch( ... )
{
MessageBox( NULL, "Unknown error", "Error", MB_OK );
}
CoUninitialize();