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

CALDATETIME

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

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

フィールド

フィールドサイズx64x86説明
CalIdDWORD4+0+0暦の識別子(グレゴリオ暦や和暦など)。
EraDWORD4+4+4年号(元号)を示す値。
YearDWORD4+8+8年。
MonthDWORD4+12+12月。
DayDWORD4+16+16日。
DayOfWeekDWORD4+20+20曜日。
HourDWORD4+24+24時(0〜23)。
MinuteDWORD4+28+28分。
SecondDWORD4+32+32秒。
TickDWORD4+36+36ミリ秒単位の刻み値。

各言語での定義

#include <windows.h>

// CALDATETIME  (x64 40 / x86 40 バイト)
typedef struct CALDATETIME {
    DWORD CalId;
    DWORD Era;
    DWORD Year;
    DWORD Month;
    DWORD Day;
    DWORD DayOfWeek;
    DWORD Hour;
    DWORD Minute;
    DWORD Second;
    DWORD Tick;
} CALDATETIME;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CALDATETIME
{
    public uint CalId;
    public uint Era;
    public uint Year;
    public uint Month;
    public uint Day;
    public uint DayOfWeek;
    public uint Hour;
    public uint Minute;
    public uint Second;
    public uint Tick;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CALDATETIME
    Public CalId As UInteger
    Public Era As UInteger
    Public Year As UInteger
    Public Month As UInteger
    Public Day As UInteger
    Public DayOfWeek As UInteger
    Public Hour As UInteger
    Public Minute As UInteger
    Public Second As UInteger
    Public Tick As UInteger
End Structure
import ctypes
from ctypes import wintypes

class CALDATETIME(ctypes.Structure):
    _fields_ = [
        ("CalId", wintypes.DWORD),
        ("Era", wintypes.DWORD),
        ("Year", wintypes.DWORD),
        ("Month", wintypes.DWORD),
        ("Day", wintypes.DWORD),
        ("DayOfWeek", wintypes.DWORD),
        ("Hour", wintypes.DWORD),
        ("Minute", wintypes.DWORD),
        ("Second", wintypes.DWORD),
        ("Tick", wintypes.DWORD),
    ]
#[repr(C)]
pub struct CALDATETIME {
    pub CalId: u32,
    pub Era: u32,
    pub Year: u32,
    pub Month: u32,
    pub Day: u32,
    pub DayOfWeek: u32,
    pub Hour: u32,
    pub Minute: u32,
    pub Second: u32,
    pub Tick: u32,
}
import "golang.org/x/sys/windows"

type CALDATETIME struct {
	CalId uint32
	Era uint32
	Year uint32
	Month uint32
	Day uint32
	DayOfWeek uint32
	Hour uint32
	Minute uint32
	Second uint32
	Tick uint32
}
type
  CALDATETIME = record
    CalId: DWORD;
    Era: DWORD;
    Year: DWORD;
    Month: DWORD;
    Day: DWORD;
    DayOfWeek: DWORD;
    Hour: DWORD;
    Minute: DWORD;
    Second: DWORD;
    Tick: DWORD;
  end;
const CALDATETIME = extern struct {
    CalId: u32,
    Era: u32,
    Year: u32,
    Month: u32,
    Day: u32,
    DayOfWeek: u32,
    Hour: u32,
    Minute: u32,
    Second: u32,
    Tick: u32,
};
type
  CALDATETIME {.bycopy.} = object
    CalId: uint32
    Era: uint32
    Year: uint32
    Month: uint32
    Day: uint32
    DayOfWeek: uint32
    Hour: uint32
    Minute: uint32
    Second: uint32
    Tick: uint32
struct CALDATETIME
{
    uint CalId;
    uint Era;
    uint Year;
    uint Month;
    uint Day;
    uint DayOfWeek;
    uint Hour;
    uint Minute;
    uint Second;
    uint Tick;
}

HSP用 定義

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

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

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