473,508 Members | 2,267 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB - API Call Retrieves Byte Array

1 New Member
All,

I have an unmanaged DLL written in C++ that I need to call using VB.NET. Specificly, the application I am developing will pull files from a handheld recording device. I have several other function working properly that provide information and verify connectivity, but I am having problem with the one function I really need...

Here is the C++ function description from the documentation:

DWORD DSXGetFileInfoFirst(BYTE bFolder, BYTE *bpHeaderBuffer)

bFolder - BYTE: Specifies the folder from which the file information is obtained.

bpHeaderBuffer - BYTE *: Specifies a pointer to the buffer in which to receive the file information. The buffer must be at least 1,024 bytes in size


Here is my implementation (or attempt at one...) in .NET:

Declare Function DSXGetFileInfoFirst Lib "DSXUSB.DLL" (ByRef bFolder As Integer, ByRef pbHeaderBuffer() As Byte) As Integer

Sub GetFiles()

Dim ret as Integer
Dim HBuffer(1024) As Byte

ret = DSXGetFileInfoFirst(1, HBuffer)

End Sub


When I call this, the DLL returns an generic exception which is probably an invalid parameter. My question then, would be is there a special I will have to do to be able to recieve the byte array? Any help/advice at this point would be greatly appreciated.
Oct 10 '07 #1
1 1694
Killer42
8,435 Recognized Expert Expert
Was this ever resoved?

I haven't worked with .Net yet, but I did notice you define your first parameter as Integer when it was Byte in C.
Mar 20 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
437
by: Steve Mauldin | last post by:
I came across an example in the MSDN documentation using RC2 encryption(the link to the article is at the end of this message). When I tried it I had a problem with getting back the same length...
77
3958
by: Eltee | last post by:
Hi everybody, Is it possible to 1. call a function from a dll made with .NET (C#) 2. from a program written in plain (as in: not .NET) C or C++? To be more specific, this is what I have. ...
3
2663
by: John Smith | last post by:
I wrote some code in C in a dll which I would like to call from C#. However I'm stuck because of the strongly typed behavior of C# which makes limitations. Here are the prototypes for two...
7
1492
by: Gabe Covert | last post by:
I'm attempting to implement a 3rd party COM library in a C# application, and have run up against the following problem in my development. I am trying to use a particular method call of an object,...
0
1733
by: bcutting | last post by:
I have the following snippet of code which which makes a call into a dll to generate an array of bytes. Its arguments are a IntPtr to the bitmap, a number, and a reference to the array that it...
2
4647
by: Gilles Vollant \(MVP\) | last post by:
Hello I've (in WinImage SDK http://www.winimage.com/wima_sdk.htm ) a function that I need to use from a VB.Net apps First, on the unmanaged Win32 DLL, I've a function which get the number of...
17
7211
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
3
3597
by: computer_guy | last post by:
Hi Everyone, I run into a problem. I am trying to write an aspx that can dynamically generate an image based on some input parameters. Things are very simple if the size of the parameters is...
0
1141
by: tomb | last post by:
Can anybody help me by checking if I have correct call signatures? In my C# Windows Form project (VS2008) I am using dll which has been written for Visual C++ 6.0: This function code is used to...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
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
7380
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
7039
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
7494
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
5050
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
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
415
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.