Solved

Converting some C++ definitions to VB6

Posted on 2008-06-20
2
203 Views
Last Modified: 2010-04-30
Hi guys,

I've been given the following code and need to get it to work in VB6. I don't necessarily need them all doing, but if you could advise me on what to replace with what to get the correct definitions in VB6 I'd really appreciate it.

Cheers,

Bob
typedef struct MsgsBlock

	{

	int				StructSize;

	int				ReturnCode;

	int				Flags;							// ProtData flags:	BIT0 = trial, BIT1 = non-web

	char			ProductKey[(MAX_PRODKEY_LEN+3)&0xfc]; // 30 bytes (16+13+1) rounded up to multiple of 4 bytes = 32

	int				NextRefresh;

	int				LocalExecsLeft;

	int				Expiry;	

	int				Features;

	int				MaxNetUsers;						// -1 = no limit

	int				WebExecsLeft;						// -1 = no limit

	char			ProductCode[MAX_PRODCODE_LEN+1];	// 17 bytes

	char			ExtendedError[32];

	} MSGSBLOCK;
 

#define	COMPANY_OPTIONAL	1

#define	COMPANY_REQUIRED	2

#define	NAME_OPTIONAL		4

#define	NAME_REQUIRED		8

#define	HOUSE_OPTIONAL		16

#define	HOUSE_REQUIRED		32

#define	STREET_OPTIONAL		64

#define	STREET_REQUIRED		128

#define	TOWN_OPTIONAL		256

#define	TOWN_REQUIRED		0x200

#define	COUNTY_OPTIONAL		0x400

#define	COUNTY_REQUIRED		0x800

#define	POSTCODE_OPTIONAL	0x1000

#define	POSTCODE_REQUIRED	0x2000

#define	COUNTRY_OPTIONAL	0x4000

#define	COUNTRY_REQUIRED	0x8000

#define	PHONE_OPTIONAL		0x10000

#define	PHONE_REQUIRED		0x20000

#define	EMAIL_OPTIONAL		0x40000

#define	EMAIL_REQUIRED		0x80000

#define EMAIL_VERIFY		0x100000		// Email required and verification required
 
 

typedef struct MsgsCountry

{

char	Code[4];

char	Name[40];

} MSGS_COUNTRY;
 

typedef struct MsgsRegInfoTag

	{

	char Name[51];

	char Company[51];

	char Address1[51];

	char Address2[51];

	char Address3[51];

	char Address4[51];

	char PostCode[11];

	char Country[4];

	char Tel[21];

	char email[51];

	} MSGS_REGINFO;

Open in new window

0
Comment
Question by:Bobeo
2 Comments
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
ID: 21836344
Here's a first pass (in the snippet)
Type MsgsBlock

    StructSize      As Long

    ReturnCode      As Long

    Flags           As Long            ' ProtData flags:  BIT0 = trial, BIT1 = non-web

    ProductKey(1 To 32)     As Byte    ' 30 bytes (16+13+1) rounded up to multiple of 4 bytes = 32

    'ProductKey     As string * 32    ' 30 bytes (16+13+1) rounded up to multiple of 4 bytes = 32

    NextRefresh     As Long

    LocalExecsLeft  As Long

    Expiry          As Long

    Features        As Long

    MaxNetUsers     As Long            ' -1 = no limit

    WebExecsLeft    As Long            ' -1 = no limit

    ProductCode(1 To 17)    As Byte    ' 17 bytes

    'ProductCode    As string * 17   ' 17 chars

    ExtendedError(1 To 32)  As Byte

    'ExtendedError As string * 32

End Type
 

Const COMPANY_OPTIONAL   As Long = 1

Const COMPANY_REQUIRED   As Long = 2

Const NAME_OPTIONAL      As Long = 4

Const NAME_REQUIRED      As Long = 8

Const HOUSE_OPTIONAL     As Long = 16

Const HOUSE_REQUIRED     As Long = 32

Const STREET_OPTIONAL    As Long = 64

Const STREET_REQUIRED    As Long = 128

Const TOWN_OPTIONAL      As Long = 256

Const TOWN_REQUIRED      As Long = &H200

Const COUNTY_OPTIONAL    As Long = &H400

Const COUNTY_REQUIRED    As Long = &H800

Const POSTCODE_OPTIONAL  As Long = &H1000

Const POSTCODE_REQUIRED  As Long = &H2000

Const COUNTRY_OPTIONAL   As Long = &H4000

Const COUNTRY_REQUIRED   As Long = &H8000

Const PHONE_OPTIONAL     As Long = &H10000

Const PHONE_REQUIRED     As Long = &H20000

Const EMAIL_OPTIONAL     As Long = &H40000

Const EMAIL_REQUIRED     As Long = &H80000

Const EMAIL_VERIFY       As Long = &H100000        ' Email required and verification required

 

 

Type MsgsCountry

    Code As String * 4

    Name As String * 40

End Type

 

Type MsgsRegInfoTag

    Name As String * 51

    Company As String * 51

    Address1 As String * 51

    Address2 As String * 51

    Address3 As String * 51

    Address4 As String * 51

    PostCode As String * 11

    Country As String * 4

    Tel As String * 21

    email As String * 51

End Type

Open in new window

0
 
LVL 3

Author Closing Comment

by:Bobeo
ID: 31469357
Spot on! Thank you!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now