473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Very simple question


How can I get array of unsigned char from VC++ dll to VB

For example:

I declared next function in VC++ dll:
int funct(int size, unsigned char* array)

I want to read the contents of array in VB

Public Function Func(ByVal size As Long, ByRef array As Byte) as Long

What should I do to read an array

Whay is this wrong?
Dim ar1(10) As Byte
For i = 0 To 10
ar1(i) = array(i)
Next i
Jul 21 '05 #1
2 835
Tomaz Rotovnik wrote:
Public Function Func(ByVal size As Long, ByRef array As Byte) as Long


I am not a VB.NET expert, but in VB.NET aren't array parameters declared
with parenthesis? Something like this:

Public Function Func(ByVal size As Long, ByVal array() As Byte) as Long

C++ treats arrays as contiguous blocks of memory, .NET treats them as
objects, so you should declare a Byte array object not a Byte pointer.

Richard
--
www.richardgrimes.com
my email ev******@zicf.bet is encrypted with ROT13 (www.rot13.org)
Jul 21 '05 #2
Tomaz Rotovnik wrote:
Public Function Func(ByVal size As Long, ByRef array As Byte) as Long


I am not a VB.NET expert, but in VB.NET aren't array parameters declared
with parenthesis? Something like this:

Public Function Func(ByVal size As Long, ByVal array() As Byte) as Long

C++ treats arrays as contiguous blocks of memory, .NET treats them as
objects, so you should declare a Byte array object not a Byte pointer.

Richard
--
www.richardgrimes.com
my email ev******@zicf.bet is encrypted with ROT13 (www.rot13.org)
Nov 22 '05 #3

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

Similar topics

0
by: Gene Ellis | last post by:
Very simple question. If I have the XML file below: <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="newspage.xsl"?> <newspage> <content>Click here for blah...
2
by: James | last post by:
I have a very simple datagrid, with an edit button that I added in PropertyBuilder. This fires the EditCommand event just fine and I show a panel where the user can edit certain fields. I have a...
16
by: lovecreatesbeauty | last post by:
`Writing C code is very simple', one guy related to my work said. I'm not sure whether he is an expert or not. What he said about C programming like this can't convince me. I think there should be...
50
by: diffuser78 | last post by:
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans
2
by: dave | last post by:
Hi, I have searched for the answer for this error message without success. I have seen the question many times though:) I create an ASP.NET project (VS 2005, C#), and use a very simple .mdf...
27
by: Paulo da Silva | last post by:
Hi! I was told in this NG that string is obsolet. I should use str methods. So, how do I join a list of strings delimited by a given char, let's say ','? Old way:
1
by: Simon | last post by:
A very simple question that is very hard to google..(so please be so kind to answer it, if you have the answer.) How can I reach an iframe, located in another frame. Situation: frameset of three...
1
by: Raycaster | last post by:
I'm 3/4 finished 2 simple VB apps for a upcoming silent auction being held at my children's school. Very Simple - This is what it does: 1st app allows input and builds a text database Unit...
4
by: maria | last post by:
I only use C++ with Visual Studio 6.0 for string manipulations in thousands of HTML pages on my website. Many times, the output files of many of my C++ programs contain a spanish question mark (¿)...
3
by: stdlib99 | last post by:
Hi, I have a simple question regarding templates and meta programming. I am going to try and work my way through the C++ Template Metaprogramming, a book by David Abrahams and Aleksey...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.