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

PRINTER_NOTIFY_OPTIONS_TYPE

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

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

フィールド

フィールドサイズx64x86説明
TypeWORD2+0+0通知対象の種別を示す値(PRINTER_NOTIFY_TYPE/JOB_NOTIFY_TYPE)。
Reserved0WORD2+2+2予約フィールド。0を設定する。
Reserved1DWORD4+4+4予約フィールド。0を設定する。
Reserved2DWORD4+8+8予約フィールド。0を設定する。
CountDWORD4+12+12pFields配列に含まれる監視フィールド数。
pFieldsWORD*8/4+16+16監視対象フィールドの識別子配列へのポインタ。

各言語での定義

#include <windows.h>

// PRINTER_NOTIFY_OPTIONS_TYPE  (x64 24 / x86 20 バイト)
typedef struct PRINTER_NOTIFY_OPTIONS_TYPE {
    WORD Type;
    WORD Reserved0;
    DWORD Reserved1;
    DWORD Reserved2;
    DWORD Count;
    WORD* pFields;
} PRINTER_NOTIFY_OPTIONS_TYPE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PRINTER_NOTIFY_OPTIONS_TYPE
{
    public ushort Type;
    public ushort Reserved0;
    public uint Reserved1;
    public uint Reserved2;
    public uint Count;
    public IntPtr pFields;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PRINTER_NOTIFY_OPTIONS_TYPE
    Public Type As UShort
    Public Reserved0 As UShort
    Public Reserved1 As UInteger
    Public Reserved2 As UInteger
    Public Count As UInteger
    Public pFields As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class PRINTER_NOTIFY_OPTIONS_TYPE(ctypes.Structure):
    _fields_ = [
        ("Type", ctypes.c_ushort),
        ("Reserved0", ctypes.c_ushort),
        ("Reserved1", wintypes.DWORD),
        ("Reserved2", wintypes.DWORD),
        ("Count", wintypes.DWORD),
        ("pFields", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct PRINTER_NOTIFY_OPTIONS_TYPE {
    pub Type: u16,
    pub Reserved0: u16,
    pub Reserved1: u32,
    pub Reserved2: u32,
    pub Count: u32,
    pub pFields: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type PRINTER_NOTIFY_OPTIONS_TYPE struct {
	Type uint16
	Reserved0 uint16
	Reserved1 uint32
	Reserved2 uint32
	Count uint32
	pFields uintptr
}
type
  PRINTER_NOTIFY_OPTIONS_TYPE = record
    Type: Word;
    Reserved0: Word;
    Reserved1: DWORD;
    Reserved2: DWORD;
    Count: DWORD;
    pFields: Pointer;
  end;
const PRINTER_NOTIFY_OPTIONS_TYPE = extern struct {
    Type: u16,
    Reserved0: u16,
    Reserved1: u32,
    Reserved2: u32,
    Count: u32,
    pFields: ?*anyopaque,
};
type
  PRINTER_NOTIFY_OPTIONS_TYPE {.bycopy.} = object
    Type: uint16
    Reserved0: uint16
    Reserved1: uint32
    Reserved2: uint32
    Count: uint32
    pFields: pointer
struct PRINTER_NOTIFY_OPTIONS_TYPE
{
    ushort Type;
    ushort Reserved0;
    uint Reserved1;
    uint Reserved2;
    uint Count;
    void* pFields;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; PRINTER_NOTIFY_OPTIONS_TYPE サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; Type : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Reserved0 : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; Reserved1 : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Reserved2 : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Count : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pFields : WORD* (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PRINTER_NOTIFY_OPTIONS_TYPE サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Type : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Reserved0 : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; Reserved1 : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Reserved2 : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Count : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pFields : WORD* (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PRINTER_NOTIFY_OPTIONS_TYPE
    #field short Type
    #field short Reserved0
    #field int Reserved1
    #field int Reserved2
    #field int Count
    #field intptr pFields
#endstruct

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