ホーム › Devices.WebServicesOnDevices › WSD_DURATION
WSD_DURATION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| isPositive | BOOL | 4 | +0 | +0 | 継続時間が正方向か否かを示すフラグ。 |
| year | DWORD | 4 | +4 | +4 | 年数成分。 |
| month | DWORD | 4 | +8 | +8 | 月数成分。 |
| day | DWORD | 4 | +12 | +12 | 日数成分。 |
| hour | DWORD | 4 | +16 | +16 | 時間数成分。 |
| minute | DWORD | 4 | +20 | +20 | 分数成分。 |
| second | DWORD | 4 | +24 | +24 | 秒数成分。 |
| millisecond | DWORD | 4 | +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 Structureimport 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: uint32struct 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