Re: convert VC++ code into VB6
"David Anton" <DavidAnton@discussions.microsoft.com> wrote in message
news:9ED5EFF5-F7C7-457F-9090-9569AFE7937D@microsoft.com...
The following conversion was produced by 'C++ to VB Converter', but the
output is VB.NET, so you will have to change Console.Write to something
else
for VB6 I believe:
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
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
--
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
"jiuge.quan@gmail.com" wrote:
we have a function in a dll. Its protocol is:
int __stdcall CKT_ReportConnections(int **pSno);
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.