Win32 API 日本語リファレンス
ホームGlobalization › NUMBERFMTA

NUMBERFMTA

構造体
サイズx64: 40 バイト / x86: 24 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
NumDigitsDWORD4+0+0小数点以下の桁数を指定する。
LeadingZeroDWORD4+4+4小数点未満が1未満のとき先頭にゼロを付けるか。0=付けない、1=付ける。
GroupingDWORD4+8+8整数部の桁区切りグルーピング指定。例えば3で3桁区切り。
lpDecimalSepLPSTR8/4+16+12小数点記号の文字列(ANSI)。
lpThousandSepLPSTR8/4+24+16桁区切り記号の文字列(ANSI)。
NegativeOrderDWORD4+32+20負数の表示形式を示す番号。括弧や符号位置を指定する0〜4の値。

各言語での定義

#include <windows.h>

// NUMBERFMTA  (x64 40 / x86 24 バイト)
typedef struct NUMBERFMTA {
    DWORD NumDigits;
    DWORD LeadingZero;
    DWORD Grouping;
    LPSTR lpDecimalSep;
    LPSTR lpThousandSep;
    DWORD NegativeOrder;
} NUMBERFMTA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NUMBERFMTA
{
    public uint NumDigits;
    public uint LeadingZero;
    public uint Grouping;
    public IntPtr lpDecimalSep;
    public IntPtr lpThousandSep;
    public uint NegativeOrder;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NUMBERFMTA
    Public NumDigits As UInteger
    Public LeadingZero As UInteger
    Public Grouping As UInteger
    Public lpDecimalSep As IntPtr
    Public lpThousandSep As IntPtr
    Public NegativeOrder As UInteger
End Structure
import ctypes
from ctypes import wintypes

class NUMBERFMTA(ctypes.Structure):
    _fields_ = [
        ("NumDigits", wintypes.DWORD),
        ("LeadingZero", wintypes.DWORD),
        ("Grouping", wintypes.DWORD),
        ("lpDecimalSep", ctypes.c_void_p),
        ("lpThousandSep", ctypes.c_void_p),
        ("NegativeOrder", wintypes.DWORD),
    ]
#[repr(C)]
pub struct NUMBERFMTA {
    pub NumDigits: u32,
    pub LeadingZero: u32,
    pub Grouping: u32,
    pub lpDecimalSep: *mut core::ffi::c_void,
    pub lpThousandSep: *mut core::ffi::c_void,
    pub NegativeOrder: u32,
}
import "golang.org/x/sys/windows"

type NUMBERFMTA struct {
	NumDigits uint32
	LeadingZero uint32
	Grouping uint32
	lpDecimalSep uintptr
	lpThousandSep uintptr
	NegativeOrder uint32
}
type
  NUMBERFMTA = record
    NumDigits: DWORD;
    LeadingZero: DWORD;
    Grouping: DWORD;
    lpDecimalSep: Pointer;
    lpThousandSep: Pointer;
    NegativeOrder: DWORD;
  end;
const NUMBERFMTA = extern struct {
    NumDigits: u32,
    LeadingZero: u32,
    Grouping: u32,
    lpDecimalSep: ?*anyopaque,
    lpThousandSep: ?*anyopaque,
    NegativeOrder: u32,
};
type
  NUMBERFMTA {.bycopy.} = object
    NumDigits: uint32
    LeadingZero: uint32
    Grouping: uint32
    lpDecimalSep: pointer
    lpThousandSep: pointer
    NegativeOrder: uint32
struct NUMBERFMTA
{
    uint NumDigits;
    uint LeadingZero;
    uint Grouping;
    void* lpDecimalSep;
    void* lpThousandSep;
    uint NegativeOrder;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NUMBERFMTA サイズ: 24 バイト(x86)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; NumDigits : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; LeadingZero : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Grouping : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; lpDecimalSep : LPSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; lpThousandSep : LPSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; NegativeOrder : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NUMBERFMTA サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; NumDigits : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; LeadingZero : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Grouping : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; lpDecimalSep : LPSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; lpThousandSep : LPSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; NegativeOrder : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NUMBERFMTA
    #field int NumDigits
    #field int LeadingZero
    #field int Grouping
    #field intptr lpDecimalSep
    #field intptr lpThousandSep
    #field int NegativeOrder
#endstruct

stdim st, NUMBERFMTA        ; NSTRUCT 変数を確保
st->NumDigits = 100
mes "NumDigits=" + st->NumDigits