|
-
Jun 23rd, 2003, 10:03 AM
#1
Thread Starter
Junior Member
C++ to VB.NET - pointers
I have the following filereader in C++
***** START
buffer = new char[buffersSize];
cbRead = buffersSize;
ReadFile(hFile,(LPVOID)buffer, buffersSize,&cbRead,POVERLAPPED)NULL)
SendBuff(0, buffer, cbRead)
****** END
The SendBuff is a function in a DLL which I want to send the buffer to.
It looks like:
short SendBuff(ushort num, LPVOID lpvBuf, ulong lBufSize)
My problem is to send the buffer to the DLL correctly.
I've read in VB.NET docs that I should use Byref.
But the only way to send the buffer is to declare the sendBuff like this:
Declare Function SendBuff Lib "test.dll" (ByVal Num As Short, ByRef lBuf As Byte(), ByVal lBufSize As Integer) As Short
What I do is that I send the buffer(32000) to the SendBuff function like this:
dim varBuff(32000) as byte
Dim varArr(varBuff) As Byte
varRet = varFS.Read(varArr, 0, varBuff)
varInt = RTD.rtdPlayBuf(0, varArr, varRet)
Any suggestions ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|