Win32 API 日本語リファレンス
ホームSystem.RemoteDesktop › WTS_SYSTEMTIME

WTS_SYSTEMTIME

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

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

フィールド

フィールドサイズx64x86説明
wYearWORD2+0+0西暦の年。WORD型の数値で表す。
wMonthWORD2+2+2月。1〜12の値で表す。
wDayOfWeekWORD2+4+4曜日。0(日曜)〜6(土曜)で表す。
wDayWORD2+6+6日。1〜31の値で表す。
wHourWORD2+8+8時。0〜23の値で表す。
wMinuteWORD2+10+10分。0〜59の値で表す。
wSecondWORD2+12+12秒。0〜59の値で表す。
wMillisecondsWORD2+14+14ミリ秒。0〜999の値で表す。

各言語での定義

#include <windows.h>

// WTS_SYSTEMTIME  (x64 16 / x86 16 バイト)
typedef struct WTS_SYSTEMTIME {
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} WTS_SYSTEMTIME;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WTS_SYSTEMTIME
{
    public ushort wYear;
    public ushort wMonth;
    public ushort wDayOfWeek;
    public ushort wDay;
    public ushort wHour;
    public ushort wMinute;
    public ushort wSecond;
    public ushort wMilliseconds;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WTS_SYSTEMTIME
    Public wYear As UShort
    Public wMonth As UShort
    Public wDayOfWeek As UShort
    Public wDay As UShort
    Public wHour As UShort
    Public wMinute As UShort
    Public wSecond As UShort
    Public wMilliseconds As UShort
End Structure
import ctypes
from ctypes import wintypes

class WTS_SYSTEMTIME(ctypes.Structure):
    _fields_ = [
        ("wYear", ctypes.c_ushort),
        ("wMonth", ctypes.c_ushort),
        ("wDayOfWeek", ctypes.c_ushort),
        ("wDay", ctypes.c_ushort),
        ("wHour", ctypes.c_ushort),
        ("wMinute", ctypes.c_ushort),
        ("wSecond", ctypes.c_ushort),
        ("wMilliseconds", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct WTS_SYSTEMTIME {
    pub wYear: u16,
    pub wMonth: u16,
    pub wDayOfWeek: u16,
    pub wDay: u16,
    pub wHour: u16,
    pub wMinute: u16,
    pub wSecond: u16,
    pub wMilliseconds: u16,
}
import "golang.org/x/sys/windows"

type WTS_SYSTEMTIME struct {
	wYear uint16
	wMonth uint16
	wDayOfWeek uint16
	wDay uint16
	wHour uint16
	wMinute uint16
	wSecond uint16
	wMilliseconds uint16
}
type
  WTS_SYSTEMTIME = record
    wYear: Word;
    wMonth: Word;
    wDayOfWeek: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;
const WTS_SYSTEMTIME = extern struct {
    wYear: u16,
    wMonth: u16,
    wDayOfWeek: u16,
    wDay: u16,
    wHour: u16,
    wMinute: u16,
    wSecond: u16,
    wMilliseconds: u16,
};
type
  WTS_SYSTEMTIME {.bycopy.} = object
    wYear: uint16
    wMonth: uint16
    wDayOfWeek: uint16
    wDay: uint16
    wHour: uint16
    wMinute: uint16
    wSecond: uint16
    wMilliseconds: uint16
struct WTS_SYSTEMTIME
{
    ushort wYear;
    ushort wMonth;
    ushort wDayOfWeek;
    ushort wDay;
    ushort wHour;
    ushort wMinute;
    ushort wSecond;
    ushort wMilliseconds;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WTS_SYSTEMTIME サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; wYear : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; wMonth : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; wDayOfWeek : WORD (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; wDay : WORD (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; wHour : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; wMinute : WORD (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; wSecond : WORD (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; wMilliseconds : WORD (+14, 2byte)  wpoke st,14,値  /  値 = wpeek(st,14)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WTS_SYSTEMTIME
    #field short wYear
    #field short wMonth
    #field short wDayOfWeek
    #field short wDay
    #field short wHour
    #field short wMinute
    #field short wSecond
    #field short wMilliseconds
#endstruct

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