Solved

Padding UDT's in VB

Posted on 2002-07-05
10
461 Views
Last Modified: 2010-05-02
I have a VB4 project and I have migrated to VB6. The app lication is making use of UDT's and I seem to have a problem with alignment. Can anyone help me here??

This is an example of one of the UDT's:-

Type typInvestCbl
   
    intVInvSeqNo                    As Integer
    intMVInvNumber                  As Integer
   
    dblMVInvBase                    As Double           'Curr I/O - updated by CBL
    dblMVPremAllocation             As Double           'I/O
    dblMVUnitValue                  As Double           'Curr I/O - updated from UV tbl
    dblMVUnitValueGainLoss          As Double
   
    dblMVUnitValueLast              As Double
    dblVInvUnits                    As Double
    dblVLastInvBase                 As Double
    dblVUpdInvBase                  As Double
    dblVInvEarnings                 As Double
    dblVLoanGuarInt                 As Double
    dblVAdjInvBase                  As Double
   
    dblVIntFactor                   As Double
    dblVSplitNIP                    As Double
    dblVMortCharge                  As Double
    dblVAdminCharge                 As Double
    dblVMortGiveback                As Double
    dblVGuarMinDeathBen             As Double
    dblVBenPremium                  As Double
    dblVSalesCharge                 As Double
    dblVExpenseCharge               As Double
    dblVUPBCharge                   As Double
    dblVRdrMlyTerMchg               As Double
    dblVNetGainLoss                 As Double
End Type

Type typInvestInputCbl
    strVStart                       As String * 8
    intMVInvDivCounter              As Integer
    ProductInvestCbl(20)            As typInvestCbl
End Type
0
Comment
Question by:DianeCrawford
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7131489
What do you mean by "problem with alignment" ?
CHeers
0
 

Author Comment

by:DianeCrawford
ID: 7131499
I have padding issue.....VB4 uses WORD alignment and VB6 uses DWord alignment so my UDT's not aligned properly when passed to an external dll....
0
 
LVL 2

Expert Comment

by:yongyih
ID: 7131514
a.. not sure about your problem.. hehe...
how about change your font to courier new?
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7131515
Yes, VB4 is 16bit and VB6 32bit. I guess that the external dll is also only 16bit, which explains the problem.
To solve, I would try to get the external dll also as 32-bit...
CHeers
0
 
LVL 6

Accepted Solution

by:
pierrecampe earned 200 total points
ID: 7131572
in the Type typInvestInputCbl
strVStart As String * 8
is actually 16 bytes long in vb6
in vb1-4 it was 8 bytes (i think)
so maybe the external dll expects 8 bytes and gets 16 ?
   
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 6

Expert Comment

by:pierrecampe
ID: 7132924
HEY, whats with the 'C' grade
if you dont like a comment then DO NOT accept it as an answer
so WHY is the 'C' ?
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7133010
Please read below.  Due to no explanation, grade changed.

Computer101
E-E Moderator


How Do I Know What Grade to Give?
Although we use an A-D scale here at Experts Exchange, it works differently than, say, school grades. If one or more Experts' proposals are accepted as answers, they should usually be given an A or B grade, since they have taken the time to provide you with a working solution. If a possible solution is incomplete - ask for clarification or details before accepting the answer and grading it. People should not be given lower grades because of incorrect grammar or because you just accepted their answer or comment to close the question. Keep in mind, your question and any follow-up comments should be focused so that there can be a specific answer. The following is a good guideline to follow when grading:

A: The Expert(s) either provided you with a thorough answer or they provided you with a link to information that thoroughly answered your question. An "A" can also be given to any answer that you found informative or enlightening beyond the direct question that you asked.

B: The Expert(s) provided an acceptable solution, or a link to an acceptable solution, that you were able to use, although you may have needed a bit more information to complete the task.

C: Because Experts' reliability are often judged by their grading records, many Experts would like the opportunity to clarify if you have questions about their solutions. If you have given the Expert(s) ample time to respond to your clarification posts and you have responded to each of their posts providing requested information; or if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option. You also have the option here of just asking Community Support to delete the question.

Remember, the Expert helping you today is probably going to be helping you next time you post a question. Give them a fair chance to earn an 'Excellent!' grade and they'll provide you with some amazing support.

0
 

Author Comment

by:DianeCrawford
ID: 7137124
Sorry Experts,

I was unaware that I gave a grade C and I didn't know until today that there was a grading system.....

Sorry this will not happen again.....

Thanks for everyone help in the past and I hope I can get help in the future....
0
 

Author Comment

by:DianeCrawford
ID: 7137134
Sorry Experts,

I was unaware that I gave a grade C and I didn't know until today that there was a grading system.....

Sorry this will not happen again.....

Thanks for everyone help in the past and I hope I can get help in the future....
0
 
LVL 6

Expert Comment

by:pierrecampe
ID: 7137557
DianeCrawford
i hereby appologize for shouting at you
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

706 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

18 Experts available now in Live!

Get 1:1 Help Now