Hi,
We are converting a VB6 GUI application that uses C++ for it's backend to VB.net front end. We are also using C++/CLI as the interface.
In the C++ the original code was passed from VB6 as
Public Type Npat_Stat
Chan As Byte
Con_stat As Byte
Con_req As Byte
Cur_serv As Byte
Num_servs As Byte
Server_id As String * 33
Last_Error As String * 51
Extra_error As String * 51
End Type
Where the C++ routine had the following parameter passed:
STDAPI_(short) Npat_Status(struct com_status *cs)
struct com_status
{
unsigned char chan;
unsigned char con_stat;
unsigned char con_req;
unsigned char cur_serv;
unsigned char num_servs;
char server_id[33];
char last_error[51];
char extra_error[51];
};
So in VB.net I have:
Public Structure Npat_Stat
Public Chan As Byte
Public Con_stat As Byte
Public Con_req As Byte
Public Cur_serv As Byte
Public Num_servs As Byte
<VBFixedString(33)> Public Server_id As String
<VBFixedString(51)> Public Last_Error As String
<VBFixedString(51)> Public Extra_error As String
End Structure
So I'm struggling to understand the best way to approach this problem. Do I create a ref class to hold the structure and pass it from VB.net as the following:
int Comms::O_Status(O_Stat ^cs)
and then somehow convert the ^cs passed in to com_status *cs to pass onto the original routine from this interface layer?
Is the fixed length string going to cause problems as well?
Any pointers on the best way to do this would be great as I'm a novice at C++, been on a course and asked to help out on this part of the project but I'm the VB6/VB.Net bod not C++
Thanks
Martin
What I have tried:
Reading MS C++/CLI online articles for examples