Win32 API 日本語リファレンス
ホームSystem.TaskScheduler › WEEKLY

WEEKLY

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

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

フィールド

フィールドサイズx64x86説明
WeeksIntervalWORD2+0+0タスクを実行する週数間隔。1は毎週、2は隔週を意味する。
rgfDaysOfTheWeekWORD2+2+2実行する曜日を示すビットマスク。日曜=0x01などのフラグを組み合わせる。

各言語での定義

#include <windows.h>

// WEEKLY  (x64 4 / x86 4 バイト)
typedef struct WEEKLY {
    WORD WeeksInterval;
    WORD rgfDaysOfTheWeek;
} WEEKLY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WEEKLY
{
    public ushort WeeksInterval;
    public ushort rgfDaysOfTheWeek;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WEEKLY
    Public WeeksInterval As UShort
    Public rgfDaysOfTheWeek As UShort
End Structure
import ctypes
from ctypes import wintypes

class WEEKLY(ctypes.Structure):
    _fields_ = [
        ("WeeksInterval", ctypes.c_ushort),
        ("rgfDaysOfTheWeek", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct WEEKLY {
    pub WeeksInterval: u16,
    pub rgfDaysOfTheWeek: u16,
}
import "golang.org/x/sys/windows"

type WEEKLY struct {
	WeeksInterval uint16
	rgfDaysOfTheWeek uint16
}
type
  WEEKLY = record
    WeeksInterval: Word;
    rgfDaysOfTheWeek: Word;
  end;
const WEEKLY = extern struct {
    WeeksInterval: u16,
    rgfDaysOfTheWeek: u16,
};
type
  WEEKLY {.bycopy.} = object
    WeeksInterval: uint16
    rgfDaysOfTheWeek: uint16
struct WEEKLY
{
    ushort WeeksInterval;
    ushort rgfDaysOfTheWeek;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WEEKLY サイズ: 4 バイト(x64)
dim st, 1    ; 4byte整数×1(構造体サイズ 4 / 4 切り上げ)
; WeeksInterval : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; rgfDaysOfTheWeek : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WEEKLY
    #field short WeeksInterval
    #field short rgfDaysOfTheWeek
#endstruct

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