Win32 API 日本語リファレンス
ホームNetworking.WindowsWebServices › WS_DURATION_DESCRIPTION

WS_DURATION_DESCRIPTION

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

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

フィールド

フィールドサイズx64x86説明
minValueWS_DURATION36+0+0最小値です。
maxValueWS_DURATION36+36+36最大値です。
comparerWS_DURATION_COMPARISON_CALLBACK8/4+72+72

WS_DURATION の比較に使用できる関数を指定します。NULL の場合は、既定の 比較関数が使用されます。

WS_DURATION は半順序であるため、すべての期間を一意に比較できるわけではありません (たとえば、1 か月と 30 日)。既定の比較関数は、年と月を指定する期間 (他の要素は指定しない)、または年と月を指定しない期間 (他の要素は任意) を比較できます。

公式ドキュメント

WS_DURATION_TYPE と共に使用される省略可能な型記述です。 逆シリアル化できる値の集合に対する制約を 指定するために使用します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// WS_DURATION  (x64 36 / x86 36 バイト)
typedef struct WS_DURATION {
    BOOL negative;
    DWORD years;
    DWORD months;
    DWORD days;
    DWORD hours;
    DWORD minutes;
    DWORD seconds;
    DWORD milliseconds;
    DWORD ticks;
} WS_DURATION;

// WS_DURATION_DESCRIPTION  (x64 80 / x86 76 バイト)
typedef struct WS_DURATION_DESCRIPTION {
    WS_DURATION minValue;
    WS_DURATION maxValue;
    WS_DURATION_COMPARISON_CALLBACK comparer;
} WS_DURATION_DESCRIPTION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WS_DURATION
{
    [MarshalAs(UnmanagedType.Bool)] public bool negative;
    public uint years;
    public uint months;
    public uint days;
    public uint hours;
    public uint minutes;
    public uint seconds;
    public uint milliseconds;
    public uint ticks;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WS_DURATION_DESCRIPTION
{
    public WS_DURATION minValue;
    public WS_DURATION maxValue;
    public IntPtr comparer;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WS_DURATION
    <MarshalAs(UnmanagedType.Bool)> Public negative As Boolean
    Public years As UInteger
    Public months As UInteger
    Public days As UInteger
    Public hours As UInteger
    Public minutes As UInteger
    Public seconds As UInteger
    Public milliseconds As UInteger
    Public ticks As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WS_DURATION_DESCRIPTION
    Public minValue As WS_DURATION
    Public maxValue As WS_DURATION
    Public comparer As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class WS_DURATION(ctypes.Structure):
    _fields_ = [
        ("negative", wintypes.BOOL),
        ("years", wintypes.DWORD),
        ("months", wintypes.DWORD),
        ("days", wintypes.DWORD),
        ("hours", wintypes.DWORD),
        ("minutes", wintypes.DWORD),
        ("seconds", wintypes.DWORD),
        ("milliseconds", wintypes.DWORD),
        ("ticks", wintypes.DWORD),
    ]

class WS_DURATION_DESCRIPTION(ctypes.Structure):
    _fields_ = [
        ("minValue", WS_DURATION),
        ("maxValue", WS_DURATION),
        ("comparer", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct WS_DURATION {
    pub negative: i32,
    pub years: u32,
    pub months: u32,
    pub days: u32,
    pub hours: u32,
    pub minutes: u32,
    pub seconds: u32,
    pub milliseconds: u32,
    pub ticks: u32,
}

#[repr(C)]
pub struct WS_DURATION_DESCRIPTION {
    pub minValue: WS_DURATION,
    pub maxValue: WS_DURATION,
    pub comparer: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type WS_DURATION struct {
	negative int32
	years uint32
	months uint32
	days uint32
	hours uint32
	minutes uint32
	seconds uint32
	milliseconds uint32
	ticks uint32
}

type WS_DURATION_DESCRIPTION struct {
	minValue WS_DURATION
	maxValue WS_DURATION
	comparer uintptr
}
type
  WS_DURATION = record
    negative: BOOL;
    years: DWORD;
    months: DWORD;
    days: DWORD;
    hours: DWORD;
    minutes: DWORD;
    seconds: DWORD;
    milliseconds: DWORD;
    ticks: DWORD;
  end;

  WS_DURATION_DESCRIPTION = record
    minValue: WS_DURATION;
    maxValue: WS_DURATION;
    comparer: Pointer;
  end;
const WS_DURATION = extern struct {
    negative: i32,
    years: u32,
    months: u32,
    days: u32,
    hours: u32,
    minutes: u32,
    seconds: u32,
    milliseconds: u32,
    ticks: u32,
};

const WS_DURATION_DESCRIPTION = extern struct {
    minValue: WS_DURATION,
    maxValue: WS_DURATION,
    comparer: ?*anyopaque,
};
type
  WS_DURATION {.bycopy.} = object
    negative: int32
    years: uint32
    months: uint32
    days: uint32
    hours: uint32
    minutes: uint32
    seconds: uint32
    milliseconds: uint32
    ticks: uint32

  WS_DURATION_DESCRIPTION {.bycopy.} = object
    minValue: WS_DURATION
    maxValue: WS_DURATION
    comparer: pointer
struct WS_DURATION
{
    int negative;
    uint years;
    uint months;
    uint days;
    uint hours;
    uint minutes;
    uint seconds;
    uint milliseconds;
    uint ticks;
}

struct WS_DURATION_DESCRIPTION
{
    WS_DURATION minValue;
    WS_DURATION maxValue;
    void* comparer;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WS_DURATION_DESCRIPTION サイズ: 76 バイト(x86)
dim st, 19    ; 4byte整数×19(構造体サイズ 76 / 4 切り上げ)
; minValue : WS_DURATION (+0, 36byte)  varptr(st)+0 を基点に操作(36byte:入れ子/配列)
; maxValue : WS_DURATION (+36, 36byte)  varptr(st)+36 を基点に操作(36byte:入れ子/配列)
; comparer : WS_DURATION_COMPARISON_CALLBACK (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WS_DURATION_DESCRIPTION サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; minValue : WS_DURATION (+0, 36byte)  varptr(st)+0 を基点に操作(36byte:入れ子/配列)
; maxValue : WS_DURATION (+36, 36byte)  varptr(st)+36 を基点に操作(36byte:入れ子/配列)
; comparer : WS_DURATION_COMPARISON_CALLBACK (+72, 8byte)  qpoke st,72,値 / qpeek(st,72)  ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WS_DURATION
    #field bool negative
    #field int years
    #field int months
    #field int days
    #field int hours
    #field int minutes
    #field int seconds
    #field int milliseconds
    #field int ticks
#endstruct

#defstruct global WS_DURATION_DESCRIPTION
    #field WS_DURATION minValue
    #field WS_DURATION maxValue
    #field intptr comparer
#endstruct

stdim st, WS_DURATION_DESCRIPTION        ; NSTRUCT 変数を確保