Re: convert VC++ code into VB6
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Thu, 27 Sep 2007 12:44:54 -0500
"David Anton" <DavidAnton@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9ED5EFF5-F7C7-457F-9090-9569AFE7937D@xxxxxxxxxxxxxxxx
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@xxxxxxxxx" 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.
.
- References:
- convert VC++ code into VB6
- From: jiuge . quan
- RE: convert VC++ code into VB6
- From: David Anton
- convert VC++ code into VB6
- Prev by Date: Determining ram in use CPU utilization
- Next by Date: Re: Support for optimization for dual core proc in C++
- Previous by thread: RE: convert VC++ code into VB6
- Next by thread: Re: In physics, the word “ entropy ” has the exact opposite meaning.
- Index(es):
Relevant Pages
|
Loading