Win32 API 日本語リファレンス
ホームNetworkManagement.WindowsConnectionManager › WCM_TIME_INTERVAL

WCM_TIME_INTERVAL

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

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

フィールド

フィールドサイズx64x86説明
wYearWORD2+0+0時間間隔の年成分。
wMonthWORD2+2+2時間間隔の月成分。
wDayWORD2+4+4時間間隔の日成分。
wHourWORD2+6+6時間間隔の時成分。
wMinuteWORD2+8+8時間間隔の分成分。
wSecondWORD2+10+10時間間隔の秒成分。
wMillisecondsWORD2+12+12時間間隔のミリ秒成分。

各言語での定義

#include <windows.h>

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WCM_TIME_INTERVAL
{
    public ushort wYear;
    public ushort wMonth;
    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 WCM_TIME_INTERVAL
    Public wYear As UShort
    Public wMonth 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 WCM_TIME_INTERVAL(ctypes.Structure):
    _fields_ = [
        ("wYear", ctypes.c_ushort),
        ("wMonth", 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 WCM_TIME_INTERVAL {
    pub wYear: u16,
    pub wMonth: u16,
    pub wDay: u16,
    pub wHour: u16,
    pub wMinute: u16,
    pub wSecond: u16,
    pub wMilliseconds: u16,
}
import "golang.org/x/sys/windows"

type WCM_TIME_INTERVAL struct {
	wYear uint16
	wMonth uint16
	wDay uint16
	wHour uint16
	wMinute uint16
	wSecond uint16
	wMilliseconds uint16
}
type
  WCM_TIME_INTERVAL = record
    wYear: Word;
    wMonth: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;
const WCM_TIME_INTERVAL = extern struct {
    wYear: u16,
    wMonth: u16,
    wDay: u16,
    wHour: u16,
    wMinute: u16,
    wSecond: u16,
    wMilliseconds: u16,
};
type
  WCM_TIME_INTERVAL {.bycopy.} = object
    wYear: uint16
    wMonth: uint16
    wDay: uint16
    wHour: uint16
    wMinute: uint16
    wSecond: uint16
    wMilliseconds: uint16
struct WCM_TIME_INTERVAL
{
    ushort wYear;
    ushort wMonth;
    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 レイアウト)
; WCM_TIME_INTERVAL サイズ: 14 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 14 / 4 切り上げ)
; wYear : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; wMonth : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; wDay : WORD (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; wHour : WORD (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; wMinute : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; wSecond : WORD (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; wMilliseconds : WORD (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WCM_TIME_INTERVAL
    #field short wYear
    #field short wMonth
    #field short wDay
    #field short wHour
    #field short wMinute
    #field short wSecond
    #field short wMilliseconds
#endstruct

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