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

MONITORINIT

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

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

フィールド

フィールドサイズx64x86説明
cbSizeDWORD4+0+0この構造体のサイズをバイト単位で指定する。
hSpoolerHANDLE8/4+8+4スプーラーのハンドル。
hckRegistryRootHKEY8/4+16+8モニター用レジストリルートキーのハンドル。
pMonitorRegMONITORREG*8/4+24+12レジストリ操作コールバック群を保持するMONITORREGへのポインター。
bLocalBOOL4+32+16ローカルモニターであればTRUE、リモートであればFALSE。
pszServerNameLPWSTR8/4+40+20対象サーバー名を指すUnicode文字列。NULL可(ローカル)。

各言語での定義

#include <windows.h>

// MONITORINIT  (x64 48 / x86 24 バイト)
typedef struct MONITORINIT {
    DWORD cbSize;
    HANDLE hSpooler;
    HKEY hckRegistryRoot;
    MONITORREG* pMonitorReg;
    BOOL bLocal;
    LPWSTR pszServerName;
} MONITORINIT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MONITORINIT
{
    public uint cbSize;
    public IntPtr hSpooler;
    public IntPtr hckRegistryRoot;
    public IntPtr pMonitorReg;
    [MarshalAs(UnmanagedType.Bool)] public bool bLocal;
    public IntPtr pszServerName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MONITORINIT
    Public cbSize As UInteger
    Public hSpooler As IntPtr
    Public hckRegistryRoot As IntPtr
    Public pMonitorReg As IntPtr
    <MarshalAs(UnmanagedType.Bool)> Public bLocal As Boolean
    Public pszServerName As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class MONITORINIT(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("hSpooler", ctypes.c_void_p),
        ("hckRegistryRoot", ctypes.c_void_p),
        ("pMonitorReg", ctypes.c_void_p),
        ("bLocal", wintypes.BOOL),
        ("pszServerName", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct MONITORINIT {
    pub cbSize: u32,
    pub hSpooler: *mut core::ffi::c_void,
    pub hckRegistryRoot: *mut core::ffi::c_void,
    pub pMonitorReg: *mut core::ffi::c_void,
    pub bLocal: i32,
    pub pszServerName: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type MONITORINIT struct {
	cbSize uint32
	hSpooler uintptr
	hckRegistryRoot uintptr
	pMonitorReg uintptr
	bLocal int32
	pszServerName uintptr
}
type
  MONITORINIT = record
    cbSize: DWORD;
    hSpooler: Pointer;
    hckRegistryRoot: Pointer;
    pMonitorReg: Pointer;
    bLocal: BOOL;
    pszServerName: Pointer;
  end;
const MONITORINIT = extern struct {
    cbSize: u32,
    hSpooler: ?*anyopaque,
    hckRegistryRoot: ?*anyopaque,
    pMonitorReg: ?*anyopaque,
    bLocal: i32,
    pszServerName: ?*anyopaque,
};
type
  MONITORINIT {.bycopy.} = object
    cbSize: uint32
    hSpooler: pointer
    hckRegistryRoot: pointer
    pMonitorReg: pointer
    bLocal: int32
    pszServerName: pointer
struct MONITORINIT
{
    uint cbSize;
    void* hSpooler;
    void* hckRegistryRoot;
    void* pMonitorReg;
    int bLocal;
    void* pszServerName;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MONITORINIT サイズ: 24 バイト(x86)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hSpooler : HANDLE (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; hckRegistryRoot : HKEY (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pMonitorReg : MONITORREG* (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; bLocal : BOOL (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; pszServerName : LPWSTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MONITORINIT サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hSpooler : HANDLE (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; hckRegistryRoot : HKEY (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; pMonitorReg : MONITORREG* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; bLocal : BOOL (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; pszServerName : LPWSTR (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MONITORINIT
    #field int cbSize
    #field intptr hSpooler
    #field intptr hckRegistryRoot
    #field intptr pMonitorReg
    #field bool bLocal
    #field intptr pszServerName
#endstruct

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