Discussion:
GetNumberFormat - using its 'override' capabilities ?
(too old to reply)
R.Wieser
2020-04-05 07:32:37 UTC
Permalink
Hello all,

Its about "GetNumberFormat" again.

https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getnumberformata

Its documentation to the "lpFormat" argument says:

[quote]
If this parameter does is not set to NULL, the function uses the locale only
for formatting information not specified in the structure
[/quote]
(and yes, that "does is not" is in there)

which seems to indicate that only the elements actually specified in that
NUMBERFMT structure will override the chosen locale (in the first argument).

The problem is that when I try that (structure fully initialized to Zero)
the function fails ('The parameter is incorrect").

My problem: How (or where) do I set the fields in that NUMBERFMT structure
to unspecified (should be ignored) ?

... if that is what is actually possible that is.

Remark:
Currently all I want to do is to override the "NumDigits" field (to Zero).

Regards,
Rudy Wieser
JJ
2020-04-05 20:52:58 UTC
Permalink
Post by R.Wieser
Hello all,
Its about "GetNumberFormat" again.
https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getnumberformata
[quote]
If this parameter does is not set to NULL, the function uses the locale only
for formatting information not specified in the structure
[/quote]
(and yes, that "does is not" is in there)
which seems to indicate that only the elements actually specified in that
NUMBERFMT structure will override the chosen locale (in the first argument).
The problem is that when I try that (structure fully initialized to Zero)
the function fails ('The parameter is incorrect").
My problem: How (or where) do I set the fields in that NUMBERFMT structure
to unspecified (should be ignored) ?
.... if that is what is actually possible that is.
Currently all I want to do is to override the "NumDigits" field (to Zero).
Regards,
Rudy Wieser
That MSDN description means that the function will use the formatting
information in the specified `Locale` argument for formatting information
which are not within NUMBERFMT structure (because the structure doesn't
contain all of them). e.g. LOCALE_IDIGITSUBSTITUTION

It doesn't mean that some or all of the NUMBERFMT structure fields are
optional. None of the integer field values can be set to "unspecified",
"auto", or "default", anyway. And the reason why the function returns that
error is because the pointer fields are NULLs - which are invalid. The
description of the NUMBERFMT structure also doesn't say that the pointer
fields can be NULL.
R.Wieser
2020-04-06 06:24:57 UTC
Permalink
JJ,
That MSDN description means ...
...
It doesn't mean that some or all of the NUMBERFMT structure fields
are optional.
Yep, that was the other way to read it.

Too bad, would have made touchups a lot easier.

Regards,
Rudy Wieser

Loading...