ホーム › Media.DeviceManager › WMDMDATETIME
WMDMDATETIME
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| wYear | WORD | 2 | +0 | +0 | 年を示す。 |
| wMonth | WORD | 2 | +2 | +2 | 月を示す。1から12の範囲となる。 |
| wDay | WORD | 2 | +4 | +4 | 日を示す。1から31の範囲となる。 |
| wHour | WORD | 2 | +6 | +6 | 時を示す。0から23の範囲となる。 |
| wMinute | WORD | 2 | +8 | +8 | 分を示す。0から59の範囲となる。 |
| wSecond | WORD | 2 | +10 | +10 | 秒を示す。0から59の範囲となる。 |
各言語での定義
#include <windows.h>
// WMDMDATETIME (x64 12 / x86 12 バイト)
typedef struct WMDMDATETIME {
WORD wYear;
WORD wMonth;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
} WMDMDATETIME;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WMDMDATETIME
{
public ushort wYear;
public ushort wMonth;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WMDMDATETIME
Public wYear As UShort
Public wMonth As UShort
Public wDay As UShort
Public wHour As UShort
Public wMinute As UShort
Public wSecond As UShort
End Structureimport ctypes
from ctypes import wintypes
class WMDMDATETIME(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),
]#[repr(C)]
pub struct WMDMDATETIME {
pub wYear: u16,
pub wMonth: u16,
pub wDay: u16,
pub wHour: u16,
pub wMinute: u16,
pub wSecond: u16,
}import "golang.org/x/sys/windows"
type WMDMDATETIME struct {
wYear uint16
wMonth uint16
wDay uint16
wHour uint16
wMinute uint16
wSecond uint16
}type
WMDMDATETIME = record
wYear: Word;
wMonth: Word;
wDay: Word;
wHour: Word;
wMinute: Word;
wSecond: Word;
end;const WMDMDATETIME = extern struct {
wYear: u16,
wMonth: u16,
wDay: u16,
wHour: u16,
wMinute: u16,
wSecond: u16,
};type
WMDMDATETIME {.bycopy.} = object
wYear: uint16
wMonth: uint16
wDay: uint16
wHour: uint16
wMinute: uint16
wSecond: uint16struct WMDMDATETIME
{
ushort wYear;
ushort wMonth;
ushort wDay;
ushort wHour;
ushort wMinute;
ushort wSecond;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WMDMDATETIME サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 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)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WMDMDATETIME
#field short wYear
#field short wMonth
#field short wDay
#field short wHour
#field short wMinute
#field short wSecond
#endstruct
stdim st, WMDMDATETIME ; NSTRUCT 変数を確保
st->wYear = 100
mes "wYear=" + st->wYear