Win32 API 日本語リファレンス
ホームGraphics.Printing › DOCEVENT_FILTER

DOCEVENT_FILTER

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

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のサイズをバイト単位で指定する。
cElementsAllocatedDWORD4+4+4aDocEventCall配列に確保された要素数。
cElementsNeededDWORD4+8+8必要な要素数を返す出力フィールド。
cElementsReturnedDWORD4+12+12実際に返された要素数。
aDocEventCallDWORD4+16+16通知を受け取るドキュメントイベントコードの配列。

各言語での定義

#include <windows.h>

// DOCEVENT_FILTER  (x64 20 / x86 20 バイト)
typedef struct DOCEVENT_FILTER {
    DWORD cbSize;
    DWORD cElementsAllocated;
    DWORD cElementsNeeded;
    DWORD cElementsReturned;
    DWORD aDocEventCall[1];
} DOCEVENT_FILTER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOCEVENT_FILTER
{
    public uint cbSize;
    public uint cElementsAllocated;
    public uint cElementsNeeded;
    public uint cElementsReturned;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public uint[] aDocEventCall;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOCEVENT_FILTER
    Public cbSize As UInteger
    Public cElementsAllocated As UInteger
    Public cElementsNeeded As UInteger
    Public cElementsReturned As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public aDocEventCall() As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DOCEVENT_FILTER(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("cElementsAllocated", wintypes.DWORD),
        ("cElementsNeeded", wintypes.DWORD),
        ("cElementsReturned", wintypes.DWORD),
        ("aDocEventCall", wintypes.DWORD * 1),
    ]
#[repr(C)]
pub struct DOCEVENT_FILTER {
    pub cbSize: u32,
    pub cElementsAllocated: u32,
    pub cElementsNeeded: u32,
    pub cElementsReturned: u32,
    pub aDocEventCall: [u32; 1],
}
import "golang.org/x/sys/windows"

type DOCEVENT_FILTER struct {
	cbSize uint32
	cElementsAllocated uint32
	cElementsNeeded uint32
	cElementsReturned uint32
	aDocEventCall [1]uint32
}
type
  DOCEVENT_FILTER = record
    cbSize: DWORD;
    cElementsAllocated: DWORD;
    cElementsNeeded: DWORD;
    cElementsReturned: DWORD;
    aDocEventCall: array[0..0] of DWORD;
  end;
const DOCEVENT_FILTER = extern struct {
    cbSize: u32,
    cElementsAllocated: u32,
    cElementsNeeded: u32,
    cElementsReturned: u32,
    aDocEventCall: [1]u32,
};
type
  DOCEVENT_FILTER {.bycopy.} = object
    cbSize: uint32
    cElementsAllocated: uint32
    cElementsNeeded: uint32
    cElementsReturned: uint32
    aDocEventCall: array[1, uint32]
struct DOCEVENT_FILTER
{
    uint cbSize;
    uint cElementsAllocated;
    uint cElementsNeeded;
    uint cElementsReturned;
    uint[1] aDocEventCall;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOCEVENT_FILTER サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; cElementsAllocated : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cElementsNeeded : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; cElementsReturned : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; aDocEventCall : DWORD (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DOCEVENT_FILTER
    #field int cbSize
    #field int cElementsAllocated
    #field int cElementsNeeded
    #field int cElementsReturned
    #field int aDocEventCall 1
#endstruct

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