Passing BYTE array to COM DLL written in VC++ [message #34076] |
Wed, 19 February 2003 08:42 |
darrick.white
Messages: 7 Registered: January 2003
|
Junior Member |
|
|
I have an issue about passing a parameter from IDL to a DLL created
from VC++. I'm using IDL's IDLcomIDispatch object to make my call.
The DLL treats the parameter as an output parameter. However, when I
pass the parameter from IDL as a BYTE array, the DLL receives garbage.
The COM object was created using VC++ ATL COM Wizard, simple object.
Below is the IDL code and VC++ function I'm trying to use.
*** IDL 5.6 CODE ***************************************
Pro ImageInfo
ref = OBJ_NEW('IDLcomIDispatch$CLSID$AF3C3F6F_299C_11D7_ABB3_00B0D 0C74243')
image = BYTE('OKAY, WHY IS THIS NOT WORKING')
result = ref->initializeImageInfo(image)
print, result
OBJ_DESTROY, ref
End
*** VC++ 6.0 CODE Segment ***************************************
STDMETHODIMP CImageInformation::initializeImageInfo
(BYTE* imageHeaderAddress,
long *returnValuePtr)
{
try
{
ofstream examplefile ("example.txt");
if (examplefile.is_open())
{
/* imageHeaderAddress is garbage */
examplefile << imageHeaderAddress << "\n";
examplefile << "Done.\n";
examplefile.close();
}
/* imageHeaderAddress will get initialized here */
*returnValuePtr =
Assistant::sInitializeImageInfo((char*)imageHeaderAddress);
.
.
.
}
|
|
|