Link to home
Start Free TrialLog in
Avatar of reacharun
reacharun

asked on

How to call a function present in a COM based DLL

I want to use a COM component known as DigiSign. Following is an extract of the help file.

About DigiSign 2.0
DigiSign implements the most popular message digest and checksum algorithms: SHA-1, SHA-256, SHA-384, SHA-512, MD5, MD2, RIPEMD160, CRC32 and ADLER32.

DigiSign can be used with any COM compliant environment: Scripting languages (VBScript, JavaScript), Visual Basic (Versions 4 and up), VBA (Word, Excel, Access ...), VC++, BC++, Delphi, Power Builder.

The VB Example that is given is as follows:

'DigiSign 2.0 VBScript Sample
'Create Hash Object
Set H = CreateObject ("DigiSign.Hash")

'Calculate the MD5 Signature of a string
S = H.CalculateStringDigest("This is our test string", 4)

====================================================================================================================
MY QUESTION is how do we do the same in C++/VC++
====================================================================================================================

Please note:
1. GUID is not provided
2. No .h files are provided
3. The above code works properly in VB
ASKER CERTIFIED SOLUTION
Avatar of mmurrell
mmurrell

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of reacharun
reacharun

ASKER

Following is the dump of errors I got after doing what you specified

--------------------Configuration: testDigi - Win32 Debug--------------------
Compiling...
testDigi.cpp
E:\workarea\msdev\testDigi\testDigi.cpp(7) : error C2065: 'IHashPtr' : undeclared identifier
E:\workarea\msdev\testDigi\testDigi.cpp(7) : error C2146: syntax error : missing ';' before identifier 'test'
E:\workarea\msdev\testDigi\testDigi.cpp(7) : error C2065: 'test' : undeclared identifier
E:\workarea\msdev\testDigi\testDigi.cpp(8) : error C2228: left of '.CreateInstance' must have class/struct/union type
E:\workarea\msdev\testDigi\testDigi.cpp(10) : error C2227: left of '->About' must point to class/struct/union
Error executing cl.exe.

testDigi.obj - 5 error(s), 0 warning(s)
Is the precompiler #import directive pointing to the correct location of the digisign DLL? I used the default installation directory.  Also, check the TLH file and ensure that the IHash object exists. Hope this will help.
No comment has been added lately, so it's time to clean up this TA. I will
leave a recommendation in the Cleanup topic area that this question is:

Answered: Points to mmurrell: Grade A

Please leave any comments here within the next seven days.

Experts: Silence means you don't care. Grading recommendations are made in light
of the posted grading guidlines (https://www.experts-exchange.com/help.jsp#hi73).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

-bcl (bcladd)
EE Cleanup Volunteer