Hello all,
I'm trying to call a third party HexEditor ActiveX control (
http://www.softerra.com/products/hexeditor.php) from within C#.
I can set all the necessary properties from C# but when I want to execute the SetData method I always run into problems.
The prototype of the SetData function in C# is seen as
int AxHexEdit.SetData(ref object pData, int dwStartAddr);
I've created a byte array that I want to display inside this HexEditor control by using the SetData function but I always get type mismatch or other errors.
Any idea of how I should pass my byte array from within C# to the SetData function to avoid errors???
Thanks in advance for all your help!
Best regards,
Dennis
Hello All,
I still have the same problem but after doing some further investigation I can definitely say that it works under C++. I'm still struggeling to get it to work under C#. Any help/suggestions/ideas are welcome.
Note:
I've added the MFC C++ code that works with the ActiveX control.
Thanks in advance for all the help!
Dennis.
Prototype:
SetData(VARIANT* pData, long dwStartAddr)
Parameters:
pData - Contains one-dimensional SAFEARRAY of bytes (i.e. pData->vt == VT_ARRAY | VT_UI1)
dwStartAddr - Starting address value in the 'address field'.
An example of call using MFC:
COleSafeArray arr;
BYTE pbData[200] = { 1, 2, 3, 4, 5 };
arr.CreateOneDim ( VT_UI1, sizeof(pbData), pbData );
(or arr.CreateOneDim ( VT_UI1, length ) for a non-initialized array)
m_ctlHexEdit.SetData ( arr );
The modified data exists in the same array, but its length may be modified in process of editing.