Converting C structures to VB 
Author Message
 Converting C structures to VB

Converting C Structures to Visual Basic

I am trying to convert a network program written in C to Visual Basic.

I have a C structure which I have converted to a VB type dec. with no
problems.  However, another C structure points to the address of the first
structure as one of its elements, as shown below:

struct Struct1                  in VB...
{                                                type Test1
   Dummy    integer;              Dummy as integer
   Dummy1   integer;              Dummy1 as integer

Quote:
}                                                endtype

struct Struct2
{                                               type Test2
   Dummy    integer               Dummy as integer
   Pointer  &Struct1              Pointer as ????????

Quote:
}                                              endtype

OK I realise that the above code is very poor C (and probably would never compile!)
but I hope it explains what I am trying to achieve in VB.

What type do I declare Pointer as in the VB type dec.  It is an address to another
structure (near in C) but I am not sure how to declare it to allow me to load a value
into it with a line such as:

global Temp1 as Test1
global Temp2 as Test2

Temp2.Pointer=Temp1     *** this will not work but it should load the address of
                                                 *** Temp1 into Temp2.Pointer

If anyone has any suggestions as to how I may achieve the above, I would be most
grateful to receive them.


Many thanks

Paul Gower



Sat, 16 May 1998 03:00:00 GMT  
 Converting C structures to VB

Quote:

>Converting C Structures to Visual Basic
>I am trying to convert a network program written in C to Visual Basic.
>I have a C structure which I have converted to a VB type dec. with no
>problems.  However, another C structure points to the address of the first
>structure as one of its elements, as shown below:
>struct Struct1                  in VB...
>{                                                type Test1
>   Dummy    integer;              Dummy as integer
>   Dummy1   integer;              Dummy1 as integer
>}                                                endtype
>struct Struct2
>{                                               type Test2
>   Dummy    integer               Dummy as integer
>   Pointer  &Struct1              Pointer as ????????
>}                                              endtype
>OK I realise that the above code is very poor C (and probably would never compile!)
>but I hope it explains what I am trying to achieve in VB.
>What type do I declare Pointer as in the VB type dec.  It is an address to another
>structure (near in C) but I am not sure how to declare it to allow me to load a value
>into it with a line such as:
>global Temp1 as Test1
>global Temp2 as Test2
>Temp2.Pointer=Temp1     *** this will not work but it should load the address of
>                                                 *** Temp1 into Temp2.Pointer
>If anyone has any suggestions as to how I may achieve the above, I would be most
>grateful to receive them.

>Many thanks
>Paul Gower

In VB declare pointer as a long, but in order to access the data from
that pointer you will have to use the API hmemcpy.  Any more questions
feel free to contact me.  Hope this helps.


Sun, 17 May 1998 03:00:00 GMT  
 Converting C structures to VB

Quote:

>Converting C Structures to Visual Basic

>I am trying to convert a network program written in C to Visual Basic.

Far pointers in C become LONG in VB.
Near pointers in C beomce INTEGER in VB.

John

------------------------------------------------------------
OVERTHROW THE AMERICAN LEGAL SYSTEM -- DON'T SERVE ON JURIES
Use any excuse to get out.  Tell them you advocate
{*filter*} overthrow of the government...whatever it takes.
If we can stop them from getting jurors then we can do
to the lawyers what they've been doing to us.
The American Legal System:
   Of the lawyers, by the lawyers, for the lawyers
------------------------------------------------



Sun, 17 May 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. HELP!! Convert C++ structure to VB

2. Converting C++ structure to VB Format

3. Help C to VB structure converting

4. Help! Converting API Structure to VB

5. Help converting a C structure to VB format

6. good VB website(s) for high school CS teacher??

7. Convert VB.Net to C#, convert C# to VB.Net

8. Convert Type to a Structure

9. How Do I convert (or cast) Structures?

10. Converting between IntPtr and structure from Win API

11. Convert Access structure to SQL script

12. Converting to new table structures

 

 
Powered by phpBB® Forum Software