473,503 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is this possible?

In a c# client I have the following:

double [] data = {1.0,2.0,3.0,4.0};
I have an OCX wriiten in c++ using dev studio 6.0.
Can I pass the array to the OCX? How would you do this?
I've looked and looked and failed so far. Is it possible?
Thanks,
Mitch.

May 2 '06 #1
3 1245
Mitch,

Yes, you can, assuming that the method on the object from the OCX is
expecting a SAFEARRAY of doubles.

Have you imported the OCX into .NET? You can easily do this by adding
it to your toolbox (there is a COM tab when you configure the toolbox).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<mi***@bmtmis.demon.co.uk> wrote in message
news:11*********************@v46g2000cwv.googlegro ups.com...
In a c# client I have the following:

double [] data = {1.0,2.0,3.0,4.0};
I have an OCX wriiten in c++ using dev studio 6.0.
Can I pass the array to the OCX? How would you do this?
I've looked and looked and failed so far. Is it possible?
Thanks,
Mitch.

May 2 '06 #2
Hello,

Thanks for your reply.

You sound condifent - like someone whose done it before? I can't.

I have successfully imported the OCX into the toolbox and have a copy
on a form.

In the .odl file I declare:

[id(3)] void UseArray([in]SAFEARRAY(double) pArray);

In the ActiveX ctl's header I declare:

afx_msg void UseArray(SAFEARRAY* pArray);

and in the ctl's dispatch map I have:

DISP_FUNCTION(CTestOCXCtrl, "UseArray", UseArray, VT_EMPTY, VTS_R8)

Is this correct? It all compiles.

In c# I have:

double [] data = {1.0,2.0,3.0,4.0};
axTestOCX1.UseArray(pArray);

And I get and Interop COMException of type mismatch.

It should be so simple. Where am I going so wrong?

Mitch.

May 3 '06 #3
Typo: Should read:

In c# I have:

System.Array pArray = new double[10];
axTestOCX1.UseArray(pArray);

And I get and Interop COMException of type mismatch.

It should be so simple. Where am I going so wrong?

May 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
14460
by: Julia Briggs | last post by:
I am struggling to create a PHP function that would take a specified image (JPG, GIF or PNG) from a link, and resize it down to a thumbnail so it will always fit in a 200x250 space. I am hoping...
36
9431
by: rbt | last post by:
Say I have a list that has 3 letters in it: I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 aaaa
20
2436
by: CHIN | last post by:
Hi all.. here s my problem ( maybe some of you saw me on other groups, but i cant find the solution !! ) I have to upload a file to an external site, so, i made a .vbs file , that logins to...
7
2335
by: Andrzej | last post by:
Is it possible to call a function which name is given by a string? Let assume that I created a program which call some functions for example void f1(void), void f2(void), void f3(void). ...
2
3783
by: Bhupesh Naik | last post by:
This is a query regarding my problem to make a spell and grammar check possible in text area of a web page. We have aspx pages which are used to construct letters. The browser based screens...
1
6941
by: AAA | last post by:
hi, I'll explain fastly the program that i'm doing.. the computer asks me to enter the cardinal of a set X ( called "dimX" type integer)where X is a table of one dimension and then to fill it...
25
2517
by: Piotr Nowak | last post by:
Hi, Say i have a server process which listens for some changes in database. When a change occurs i want to refresh my page in browser by notyfinig it. I do not want to refresh my page i.e....
4
7642
by: RSH | last post by:
Okay my math skills aren't waht they used to be... With that being said what Im trying to do is create a matrix that given x number of columns, and y number of possible values i want to generate...
7
3346
by: Robert S. | last post by:
Searching some time now for documents on this but still did not find anything about it: Is it possible to replace the entry screen of MS Office Access 2007 - that one presenting that default...
14
1987
by: bjorklund.emil | last post by:
Hello pythonistas. I'm a newbie to pretty much both programming and Python. I have a task that involves writing a test script for every possible combination of preference settings for a software...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.