VC demo code is:
[
int *pSno;
int count = CKT_ReportConnections(&pSno);
for (int i=0; i<count; ++i)
printf("%d", pSno[i]);
]
How can I write the same in VB6?
I may know this function declaration that maybe is :
[
Public Declare Function CKT_ReportConnections Lib
"DLLNAME.dll" (ByRef
pSno As Long) As Long
]
But then what i should write the above demo in VB6?
Thx a lot.
Dim pSno As Integer
Dim count As Integer = CKT_ReportConnections(pSno)
For i As Integer = 0 To count - 1
Console.Write("{0:D}", pSno(i))
Next i
--
David Anton
http://www.tangiblesoftwaresolutions.com
Convert between VB, C#, C++, and Java
Instant C#
Instant VB
Instant C++
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
You can't convert a pointer to an Integer and then subscript it, so that's
wrong even in VB.NET. Data types are also different from VB.NET to VB6.
Something like this would work in VB6:
Dim pSno As Long
Dim count As Integer = CKT_ReportConnections(pSno)
Dim Sno(0 To count - 1) As Long
MoveMemory(ByRef Sno(0), pSno, 4 * count)
now the data is in a VB6 array named Sno
Get the import declaration for function MoveMemory from winapi.txt