ホーム › Networking.WindowsWebServices › WS_DURATION
WS_DURATION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| negative | BOOL | 4 | +0 | +0 | 期間が負(過去方向)であればTRUEを示すブール値。 |
| years | DWORD | 4 | +4 | +4 | 期間に含まれる年数。 |
| months | DWORD | 4 | +8 | +8 | 期間に含まれる月数。 |
| days | DWORD | 4 | +12 | +12 | 期間に含まれる日数。 |
| hours | DWORD | 4 | +16 | +16 | 期間に含まれる時間数。 |
| minutes | DWORD | 4 | +20 | +20 | 期間に含まれる分数。 |
| seconds | DWORD | 4 | +24 | +24 | 期間に含まれる秒数。 |
| milliseconds | DWORD | 4 | +28 | +28 | 期間に含まれるミリ秒数。 |
| ticks | DWORD | 4 | +32 | +32 | 期間に含まれる100ナノ秒単位のティック数。 |
各言語での定義
#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;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;
}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 Structureimport 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),
]#[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,
}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 = record
negative: BOOL;
years: DWORD;
months: DWORD;
days: DWORD;
hours: DWORD;
minutes: DWORD;
seconds: DWORD;
milliseconds: DWORD;
ticks: DWORD;
end;const WS_DURATION = extern struct {
negative: i32,
years: u32,
months: u32,
days: u32,
hours: u32,
minutes: u32,
seconds: u32,
milliseconds: u32,
ticks: u32,
};type
WS_DURATION {.bycopy.} = object
negative: int32
years: uint32
months: uint32
days: uint32
hours: uint32
minutes: uint32
seconds: uint32
milliseconds: uint32
ticks: uint32struct WS_DURATION
{
int negative;
uint years;
uint months;
uint days;
uint hours;
uint minutes;
uint seconds;
uint milliseconds;
uint ticks;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WS_DURATION サイズ: 36 バイト(x64)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; negative : BOOL (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; years : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; months : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; days : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; hours : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; minutes : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; seconds : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; milliseconds : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ticks : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#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
stdim st, WS_DURATION ; NSTRUCT 変数を確保
st->negative = 100
mes "negative=" + st->negative