[ QUOTE ]
Please find the code line which gives error when build:
jdeStrncpy(szDecimal,
(const JCHAR *)&lpDS->mnAmountField.String[lpDS->mnAmountField.nLength - lpDS->mnAmountField.nDecimalPosition],
DIM(lpDS->mnAmountField.nDecimalPosition - 1));
[/ QUOTE ]
A better question might be what is this line of code trying to accomplish. It's kind of hard to know where to begin. I am curious what the original, Xe version of the code looked like.
It looks like you are either trying to get the integer portion of a number, the fractional portion of the number or possibly both. If that is the case I would STRONGLY suggest re-writng this and using the various MATH_NUMERIC API calls to get the number(s) or info that you need and then, if you still need the result as a string, formatting the MATH_NUMERIC API result(s) as a string(s). Working directly with the MATH_NUMERIC struct members in the manor shown above is usually a recipe for disaster. In fact the "String" member of MATH_NUMERIC is NOT unicode, so your use of unicode API is going to fail anyway. Even if I could get your statement above to compile, or even close to syntatically correct it is still probably not going to work.
From a simple compilation standpoint it wont compile because of how you are using the DIM macro. DIM expands to the following:
#define DIM(x) (sizeof(x)/sizeof(x[0]))
The DIM macro works on a fixed array of any data type (it can't be used on a pointer). As used in the line of code above... it's really not even close. When used in the context of a string function like jdeStrncpy it is usually used on the destination string (which is just a JCHAR array) as in:
<font class="small">Code:</font><hr /><pre>
jdeStrncpy(szDest, szSrc, DIM(szDest)-1);
</pre><hr />
This useage really just prevents buffer overruns. If you truly want to copy just a portion of szSrc you probably wouldn't be using the DIM macro but instead the number of characters from szSrc you want to copy.
So in your code above DIM is
(1) not being used on an array.
(2) the "-1" should not be part of the parameter expression passed to DIM... you probably wanted it on the outside, which is a moot point because of of point(1).
(3) jdeStrncpy is a unicode call, lpDS->mnAmountField.String is NOT a unicode string.
Again, if you get this line of code to compile I am almost 100% certain that it is still wrong.