C pointer to VB 
Author Message
 C pointer to VB

I have the following structure

typedef struct
{
 Name;
 Address;
 City;
 Province;
 Status;
 Department;

Quote:
} DataRec;

The function GetData receives a pointer to the structure.

BOOL __stdcall GetData (const DataRec *a_psDataRec)

I would like to send this pointer to VB

The line:
int la_psDataRec;
 la_psDataRec =  &a_psDataRec[0];
generates the following error

error C2440: '=' : cannot convert from 'const DataRec *' to 'int'
        This conversion requires a reinterpret_cast, a C-style cast or
function-style cast

What am I doing wrong

I read somewhere that you can pass the address of the first element of an
array of  stuctures to VB by passing the first element by reference. How do
I do this, My vb program expect the address as a long

Your help is greatly appreciated.

Regards

Guno



Wed, 15 Sep 2004 03:01:15 GMT  
 C pointer to VB
This might not be of much help, but check out the AddressOf operator in the
MSDN

--

Rafael Szuminski
www.BDCSoftware.com
Phone: (949) 370 - 4920



Quote:

> I have the following structure

> typedef struct
> {
>  Name;
>  Address;
>  City;
>  Province;
>  Status;
>  Department;

> } DataRec;

> The function GetData receives a pointer to the structure.

> BOOL __stdcall GetData (const DataRec *a_psDataRec)

> I would like to send this pointer to VB

> The line:
> int la_psDataRec;
>  la_psDataRec =  &a_psDataRec[0];
> generates the following error

> error C2440: '=' : cannot convert from 'const DataRec *' to 'int'
>         This conversion requires a reinterpret_cast, a C-style cast or
> function-style cast

> What am I doing wrong

> I read somewhere that you can pass the address of the first element of an
> array of  stuctures to VB by passing the first element by reference. How
do
> I do this, My vb program expect the address as a long

> Your help is greatly appreciated.

> Regards

> Guno



Wed, 15 Sep 2004 09:54:21 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to use pointer and the pointer of pointedness pointer in vb

2. How to use pointer and the pointer of pointedness pointer in vb

3. How to use pointer and the pointer of pointedness pointer in vb

4. How to use pointer and the pointer of pointedness pointer in vb

5. How to use pointer and the pointer of pointedness pointer in vb

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

7. Passing pointer to pointer to C struct from VB into a DLL

8. assigning a returned pointer to a pointer in VB

9. pointers to pointers in VB?

10. how to convert the pointer and address of pointer in vc to vb

11. how to convert the pointer and address of pointer in vc to vb

12. VB using c pointer to pointer

 

 
Powered by phpBB® Forum Software