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

PRINTER_NOTIFY_INFO_DATA

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

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

フィールド

フィールドサイズx64x86説明
TypeWORD2+0+0通知対象の種別を示す値(PRINTER_NOTIFY_TYPE/JOB_NOTIFY_TYPE)。
FieldWORD2+2+2変更されたフィールドの識別子。
ReservedDWORD4+4+4予約フィールド。0を設定する。
IdDWORD4+8+8変更が発生した対象(ジョブID等)の識別子。
NotifyData_NotifyData_e__Union8+16+12変更後の値を保持する無名共用体(整数/文字列/バイナリ)。

共用体: _NotifyData_e__Union x64 8B / x86 8B

フィールドサイズx64x86
adwDataDWORD8+0+0
Data_Data_e__Struct8/4+0+0

各言語での定義

#include <windows.h>

// PRINTER_NOTIFY_INFO_DATA  (x64 24 / x86 20 バイト)
typedef struct PRINTER_NOTIFY_INFO_DATA {
    WORD Type;
    WORD Field;
    DWORD Reserved;
    DWORD Id;
    _NotifyData_e__Union NotifyData;
} PRINTER_NOTIFY_INFO_DATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PRINTER_NOTIFY_INFO_DATA
{
    public ushort Type;
    public ushort Field;
    public uint Reserved;
    public uint Id;
    public _NotifyData_e__Union NotifyData;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PRINTER_NOTIFY_INFO_DATA
    Public Type As UShort
    Public Field As UShort
    Public Reserved As UInteger
    Public Id As UInteger
    Public NotifyData As _NotifyData_e__Union
End Structure
import ctypes
from ctypes import wintypes

class PRINTER_NOTIFY_INFO_DATA(ctypes.Structure):
    _fields_ = [
        ("Type", ctypes.c_ushort),
        ("Field", ctypes.c_ushort),
        ("Reserved", wintypes.DWORD),
        ("Id", wintypes.DWORD),
        ("NotifyData", _NotifyData_e__Union),
    ]
#[repr(C)]
pub struct PRINTER_NOTIFY_INFO_DATA {
    pub Type: u16,
    pub Field: u16,
    pub Reserved: u32,
    pub Id: u32,
    pub NotifyData: _NotifyData_e__Union,
}
import "golang.org/x/sys/windows"

type PRINTER_NOTIFY_INFO_DATA struct {
	Type uint16
	Field uint16
	Reserved uint32
	Id uint32
	NotifyData _NotifyData_e__Union
}
type
  PRINTER_NOTIFY_INFO_DATA = record
    Type: Word;
    Field: Word;
    Reserved: DWORD;
    Id: DWORD;
    NotifyData: _NotifyData_e__Union;
  end;
const PRINTER_NOTIFY_INFO_DATA = extern struct {
    Type: u16,
    Field: u16,
    Reserved: u32,
    Id: u32,
    NotifyData: _NotifyData_e__Union,
};
type
  PRINTER_NOTIFY_INFO_DATA {.bycopy.} = object
    Type: uint16
    Field: uint16
    Reserved: uint32
    Id: uint32
    NotifyData: _NotifyData_e__Union
struct PRINTER_NOTIFY_INFO_DATA
{
    ushort Type;
    ushort Field;
    uint Reserved;
    uint Id;
    _NotifyData_e__Union NotifyData;
}

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

stdim st, PRINTER_NOTIFY_INFO_DATA        ; NSTRUCT 変数を確保
st->Type = 100
mes "Type=" + st->Type
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。