Safearrays, VB and C++ DLL (Oh, and HELP!!!)

J

J B

Hello-

I am having an issue. I have a triple dim array passing from VB to a
C++ dll. It receives the array as a Safearray. So far so good. Then I try
to copy the data from the safearray into an array I can manipulate but it
keeps creating data where there shouldn't be any. Basically, the array is a
set of 1's or 0's and it keeps saying there are more 1's than there actually
is. I am passing an array of ints which I know is a short in C++ (aka 2
bits instead of 4). I am using the safearray api calls but it isn't working
correctly. I also tried accessing the array by typecasting it to a short
pointer (aka ptrShort = (short*)(theVBArray)->pvData;) but that doesn't
work either (And really, who wants to DIRECTLY access memory?). Any ideas?
I really really need some help on this one...


Thanks,

Josh
 
R

red floyd

J said:
Hello-

I am having an issue. I have a triple dim array passing from VB to a
C++ dll. It receives the array as a Safearray. So far so good. Then I try
to copy the data from the safearray into an array I can manipulate but it
keeps creating data where there shouldn't be any. Basically, the array is a
set of 1's or 0's and it keeps saying there are more 1's than there actually
is. I am passing an array of ints which I know is a short in C++ (aka 2
bits instead of 4). I am using the safearray api calls but it isn't working
correctly. I also tried accessing the array by typecasting it to a short
pointer (aka ptrShort = (short*)(theVBArray)->pvData;) but that doesn't
work either (And really, who wants to DIRECTLY access memory?). Any ideas?
I really really need some help on this one...

Safearrays, VB, and DLLs are not part of the C++ Standard. Try a MS
specific newsgroup. Look on news.microsoft.com.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top