Solved

Padding UDT's in VB

Posted on 2002-07-05
10
476 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 143

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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 143

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
 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How does CurrentUser work? 10 38
Getting warning: You are about to delete 1 row(s) 9 52
RUNRMTCMD from AS/400 12 68
VB6 - Scroll Mouse wheel on Picturebox 13 69
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

790 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