Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 12th, 2004, 06:51 AM
NoXuS
Guest
 
Posts: n/a
Default Calling 3rd party ActiveX control -> type mismatch

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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Where to obtain 3rd party components MichaelBate General .NET 1 August 29th, 2008 08:00 PM
3rd party application from ASP MehulCSC Classic ASP Basics 1 June 9th, 2008 01:18 PM
Favorite 3rd party software with MySQL MySQLGeek MySQL 0 January 11th, 2008 05:32 AM
after creating chart -> type mismatch error kritimehrotra Excel VBA 2 July 19th, 2006 01:58 PM
Crystal and Oracle and 3rd Party narooma.12 Crystal Reports 0 January 4th, 2005 04:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.