Tom Verbruggen
June 26th, 2001, 07:11 AM
Hi,
I have the following problem passing parameters from VB to C++.
I have the following declaration in C++
typedef union
{
UCHAR mrn [MRNlen + 1];
UCHAR isn [ISNlen + 1];
NETWORK msgnet;
USHORT msglen;
UCHAR msgok [OKlen + 1];
UCHAR msgack [ACKlen + 1];
UCHAR msgroute [ROUTlen + 1];
UCHAR msgcomment [CMTlen + 1];
TX_HEADER txhead;
UCHAR msguser [UIDlen + 1];
UCHAR msgtrusr [UIDlen + 1];
TX_INFO txinfo;
UCHAR msgmac [MSGMAClen + 1];
UCHAR msgpac [MSGPAClen + 1];
} FIELD;
typedef FIELD *PFIELD;
typedef PFIELD *PPFIELD;
.
My entry point for my DLL is as follows :
USHORT _stdcall VBENMWriteField(FIELDTYPE VBFieldType, PFIELD VBField)
{
USHORT ENMrc;
ENMrc = ENMWriteField(VBFieldType, VBField);
return ENMrc;
}
.
I have tried the following declaration in my VB but it only works for numeric values...
Declare Function VBENMWriteField Lib "enmvbapi" (byval FieldType as Long, byref VBField as Any) as Integer
.
This declaration does not work with STRINGS because a VB string is not the same as a C string and when passed By Ref, you receive rubbish in the pointer...
HOW CAN I declare my function in VB or how can I solve this problem so I can pass STRINGS as well as integers !!!
PS : This is quit urgent because I have a deadline by the end of the week !!!
I have the following problem passing parameters from VB to C++.
I have the following declaration in C++
typedef union
{
UCHAR mrn [MRNlen + 1];
UCHAR isn [ISNlen + 1];
NETWORK msgnet;
USHORT msglen;
UCHAR msgok [OKlen + 1];
UCHAR msgack [ACKlen + 1];
UCHAR msgroute [ROUTlen + 1];
UCHAR msgcomment [CMTlen + 1];
TX_HEADER txhead;
UCHAR msguser [UIDlen + 1];
UCHAR msgtrusr [UIDlen + 1];
TX_INFO txinfo;
UCHAR msgmac [MSGMAClen + 1];
UCHAR msgpac [MSGPAClen + 1];
} FIELD;
typedef FIELD *PFIELD;
typedef PFIELD *PPFIELD;
.
My entry point for my DLL is as follows :
USHORT _stdcall VBENMWriteField(FIELDTYPE VBFieldType, PFIELD VBField)
{
USHORT ENMrc;
ENMrc = ENMWriteField(VBFieldType, VBField);
return ENMrc;
}
.
I have tried the following declaration in my VB but it only works for numeric values...
Declare Function VBENMWriteField Lib "enmvbapi" (byval FieldType as Long, byref VBField as Any) as Integer
.
This declaration does not work with STRINGS because a VB string is not the same as a C string and when passed By Ref, you receive rubbish in the pointer...
HOW CAN I declare my function in VB or how can I solve this problem so I can pass STRINGS as well as integers !!!
PS : This is quit urgent because I have a deadline by the end of the week !!!