Getting grouping's number right...

by Michael S. Kaplan, published on 2007/12/28 10:01 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/12/28/6883105.aspx


Developer Amy asked:

Hi

I need to display number with the setting in Regional Options on Digital grouping symbol and Digital grouping

I tried using VarBstrFromR8 and passing LOCALE_NOUSEROVERRIDE  to dwFlags but it doesn’t seem to do the trick.

Any hint?

Thanks
Amy

This question was really interesting to me since Amy was actually wanting to pick up the user's settings from Regional and Language Options yet was passing the LOCALE_NOUSEROVERRIDE flag, which is documented as:

Uses the system default locale settings, rather than custom locale settings.

So clearly that would not be something to pass....

But she implied in the message that she had actually both passing and not passing the flags, do I quickly moved in from there. :-)

It does appear that VarBstrFromR8 does not do as good of a job as GetNumberFormat and GetNumberFormatEx do for all of the various locale-specific and user-overridden grouping information that it might, and I definitely would recommend using GetNumberFormat or GetNumberFormatEx directly in order to assure the right results.

COM and OLE automation just have too many strange and intricate compatibility behaviors, which made me stop trusting those results to be internationally correct year ago....

 

This post brought to you by(U+0edc, aka LAO HO NO)


no comments

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

go to newer or older post, or back to index or month or day