Win32 API 日本語リファレンス
ホームDevices.WebServicesOnDevices › WSD_DURATION

WSD_DURATION

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

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

フィールド

フィールドサイズx64x86説明
isPositiveBOOL4+0+0継続時間が正方向か否かを示すフラグ。
yearDWORD4+4+4年数成分。
monthDWORD4+8+8月数成分。
dayDWORD4+12+12日数成分。
hourDWORD4+16+16時間数成分。
minuteDWORD4+20+20分数成分。
secondDWORD4+24+24秒数成分。
millisecondDWORD4+28+28ミリ秒成分。

各言語での定義

#include <windows.h>

// WSD_DURATION  (x64 32 / x86 32 バイト)
typedef struct WSD_DURATION {
    BOOL isPositive;
    DWORD year;
    DWORD month;
    DWORD day;
    DWORD hour;
    DWORD minute;
    DWORD second;
    DWORD millisecond;
} WSD_DURATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WSD_DURATION
{
    [MarshalAs(UnmanagedType.Bool)] public bool isPositive;
    public uint year;
    public uint month;
    public uint day;
    public uint hour;
    public uint minute;
    public uint second;
    public uint millisecond;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WSD_DURATION
    <MarshalAs(UnmanagedType.Bool)> Public isPositive As Boolean
    Public year As UInteger
    Public month As UInteger
    Public day As UInteger
    Public hour As UInteger
    Public minute As UInteger
    Public second As UInteger
    Public millisecond As UInteger
End Structure
import ctypes
from ctypes import wintypes

class WSD_DURATION(ctypes.Structure):
    _fields_ = [
        ("isPositive", wintypes.BOOL),
        ("year", wintypes.DWORD),
        ("month", wintypes.DWORD),
        ("day", wintypes.DWORD),
        ("hour", wintypes.DWORD),
        ("minute", wintypes.DWORD),
        ("second", wintypes.DWORD),
        ("millisecond", wintypes.DWORD),
    ]
#[repr(C)]
pub struct WSD_DURATION {
    pub isPositive: i32,
    pub year: u32,
    pub month: u32,
    pub day: u32,
    pub hour: u32,
    pub minute: u32,
    pub second: u32,
    pub millisecond: u32,
}
import "golang.org/x/sys/windows"

type WSD_DURATION struct {
	isPositive int32
	year uint32
	month uint32
	day uint32
	hour uint32
	minute uint32
	second uint32
	millisecond uint32
}
type
  WSD_DURATION = record
    isPositive: BOOL;
    year: DWORD;
    month: DWORD;
    day: DWORD;
    hour: DWORD;
    minute: DWORD;
    second: DWORD;
    millisecond: DWORD;
  end;
const WSD_DURATION = extern struct {
    isPositive: i32,
    year: u32,
    month: u32,
    day: u32,
    hour: u32,
    minute: u32,
    second: u32,
    millisecond: u32,
};
type
  WSD_DURATION {.bycopy.} = object
    isPositive: int32
    year: uint32
    month: uint32
    day: uint32
    hour: uint32
    minute: uint32
    second: uint32
    millisecond: uint32
struct WSD_DURATION
{
    int isPositive;
    uint year;
    uint month;
    uint day;
    uint hour;
    uint minute;
    uint second;
    uint millisecond;
}

HSP用 定義

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

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

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