?
Solved

Converting some C++ definitions to VB6

Posted on 2008-06-20
2
Medium Priority
?
220 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 46

Accepted Solution

by:
aikimark earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

809 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