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

FindNextPrinterChangeNotification

関数
発生したプリンター変更通知の内容を取得する。
DLLwinspool.drv呼出規約winapi

シグネチャ

// winspool.drv
#include <windows.h>

BOOL FindNextPrinterChangeNotification(
    FINDPRINTERCHANGENOTIFICATION_HANDLE hChange,
    DWORD* pdwChange,   // optional
    void* pvReserved,   // optional
    void** ppPrinterNotifyInfo   // optional
);

パラメーター

名前方向
hChangeFINDPRINTERCHANGENOTIFICATION_HANDLEin
pdwChangeDWORD*outoptional
pvReservedvoid*inoptional
ppPrinterNotifyInfovoid**outoptional

戻り値の型: BOOL

各言語での呼び出し定義

// winspool.drv
#include <windows.h>

BOOL FindNextPrinterChangeNotification(
    FINDPRINTERCHANGENOTIFICATION_HANDLE hChange,
    DWORD* pdwChange,   // optional
    void* pvReserved,   // optional
    void** ppPrinterNotifyInfo   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("winspool.drv", ExactSpelling = true)]
static extern bool FindNextPrinterChangeNotification(
    FINDPRINTERCHANGENOTIFICATION_HANDLE hChange,   // FINDPRINTERCHANGENOTIFICATION_HANDLE
    IntPtr pdwChange,   // DWORD* optional, out
    IntPtr pvReserved,   // void* optional
    IntPtr ppPrinterNotifyInfo   // void** optional, out
);
<DllImport("winspool.drv", ExactSpelling:=True)>
Public Shared Function FindNextPrinterChangeNotification(
    hChange As FINDPRINTERCHANGENOTIFICATION_HANDLE,   ' FINDPRINTERCHANGENOTIFICATION_HANDLE
    pdwChange As IntPtr,   ' DWORD* optional, out
    pvReserved As IntPtr,   ' void* optional
    ppPrinterNotifyInfo As IntPtr   ' void** optional, out
) As Boolean
End Function
' hChange : FINDPRINTERCHANGENOTIFICATION_HANDLE
' pdwChange : DWORD* optional, out
' pvReserved : void* optional
' ppPrinterNotifyInfo : void** optional, out
Declare PtrSafe Function FindNextPrinterChangeNotification Lib "winspool.drv" ( _
    ByVal hChange As LongPtr, _
    ByVal pdwChange As LongPtr, _
    ByVal pvReserved As LongPtr, _
    ByVal ppPrinterNotifyInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FindNextPrinterChangeNotification = ctypes.windll.LoadLibrary("winspool.drv").FindNextPrinterChangeNotification
FindNextPrinterChangeNotification.restype = wintypes.BOOL
FindNextPrinterChangeNotification.argtypes = [
    FINDPRINTERCHANGENOTIFICATION_HANDLE,  # hChange : FINDPRINTERCHANGENOTIFICATION_HANDLE
    ctypes.POINTER(wintypes.DWORD),  # pdwChange : DWORD* optional, out
    ctypes.POINTER(None),  # pvReserved : void* optional
    ctypes.c_void_p,  # ppPrinterNotifyInfo : void** optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('winspool.drv')
FindNextPrinterChangeNotification = Fiddle::Function.new(
  lib['FindNextPrinterChangeNotification'],
  [
    Fiddle::TYPE_VOIDP,  # hChange : FINDPRINTERCHANGENOTIFICATION_HANDLE
    Fiddle::TYPE_VOIDP,  # pdwChange : DWORD* optional, out
    Fiddle::TYPE_VOIDP,  # pvReserved : void* optional
    Fiddle::TYPE_VOIDP,  # ppPrinterNotifyInfo : void** optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "winspool.drv")]
extern "system" {
    fn FindNextPrinterChangeNotification(
        hChange: FINDPRINTERCHANGENOTIFICATION_HANDLE,  // FINDPRINTERCHANGENOTIFICATION_HANDLE
        pdwChange: *mut u32,  // DWORD* optional, out
        pvReserved: *mut (),  // void* optional
        ppPrinterNotifyInfo: *mut *mut ()  // void** optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("winspool.drv")]
public static extern bool FindNextPrinterChangeNotification(FINDPRINTERCHANGENOTIFICATION_HANDLE hChange, IntPtr pdwChange, IntPtr pvReserved, IntPtr ppPrinterNotifyInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'winspool.drv_FindNextPrinterChangeNotification' -Namespace Win32 -PassThru
# $api::FindNextPrinterChangeNotification(hChange, pdwChange, pvReserved, ppPrinterNotifyInfo)
#uselib "winspool.drv"
#func global FindNextPrinterChangeNotification "FindNextPrinterChangeNotification" sptr, sptr, sptr, sptr
; FindNextPrinterChangeNotification hChange, varptr(pdwChange), pvReserved, ppPrinterNotifyInfo   ; 戻り値は stat
; hChange : FINDPRINTERCHANGENOTIFICATION_HANDLE -> "sptr"
; pdwChange : DWORD* optional, out -> "sptr"
; pvReserved : void* optional -> "sptr"
; ppPrinterNotifyInfo : void** optional, out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "winspool.drv"
#cfunc global FindNextPrinterChangeNotification "FindNextPrinterChangeNotification" int, var, sptr, sptr
; res = FindNextPrinterChangeNotification(hChange, pdwChange, pvReserved, ppPrinterNotifyInfo)
; hChange : FINDPRINTERCHANGENOTIFICATION_HANDLE -> "int"
; pdwChange : DWORD* optional, out -> "var"
; pvReserved : void* optional -> "sptr"
; ppPrinterNotifyInfo : void** optional, out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL FindNextPrinterChangeNotification(FINDPRINTERCHANGENOTIFICATION_HANDLE hChange, DWORD* pdwChange, void* pvReserved, void** ppPrinterNotifyInfo)
#uselib "winspool.drv"
#cfunc global FindNextPrinterChangeNotification "FindNextPrinterChangeNotification" int, var, intptr, intptr
; res = FindNextPrinterChangeNotification(hChange, pdwChange, pvReserved, ppPrinterNotifyInfo)
; hChange : FINDPRINTERCHANGENOTIFICATION_HANDLE -> "int"
; pdwChange : DWORD* optional, out -> "var"
; pvReserved : void* optional -> "intptr"
; ppPrinterNotifyInfo : void** optional, out -> "intptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winspool_drv = windows.NewLazySystemDLL("winspool.drv")
	procFindNextPrinterChangeNotification = winspool_drv.NewProc("FindNextPrinterChangeNotification")
)

// hChange (FINDPRINTERCHANGENOTIFICATION_HANDLE), pdwChange (DWORD* optional, out), pvReserved (void* optional), ppPrinterNotifyInfo (void** optional, out)
r1, _, err := procFindNextPrinterChangeNotification.Call(
	uintptr(hChange),
	uintptr(pdwChange),
	uintptr(pvReserved),
	uintptr(ppPrinterNotifyInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function FindNextPrinterChangeNotification(
  hChange: FINDPRINTERCHANGENOTIFICATION_HANDLE;   // FINDPRINTERCHANGENOTIFICATION_HANDLE
  pdwChange: Pointer;   // DWORD* optional, out
  pvReserved: Pointer;   // void* optional
  ppPrinterNotifyInfo: Pointer   // void** optional, out
): BOOL; stdcall;
  external 'winspool.drv' name 'FindNextPrinterChangeNotification';
result := DllCall("winspool.drv\FindNextPrinterChangeNotification"
    , "Ptr", hChange   ; FINDPRINTERCHANGENOTIFICATION_HANDLE
    , "Ptr", pdwChange   ; DWORD* optional, out
    , "Ptr", pvReserved   ; void* optional
    , "Ptr", ppPrinterNotifyInfo   ; void** optional, out
    , "Int")   ; return: BOOL
●FindNextPrinterChangeNotification(hChange, pdwChange, pvReserved, ppPrinterNotifyInfo) = DLL("winspool.drv", "bool FindNextPrinterChangeNotification(void*, void*, void*, void*)")
# 呼び出し: FindNextPrinterChangeNotification(hChange, pdwChange, pvReserved, ppPrinterNotifyInfo)
# hChange : FINDPRINTERCHANGENOTIFICATION_HANDLE -> "void*"
# pdwChange : DWORD* optional, out -> "void*"
# pvReserved : void* optional -> "void*"
# ppPrinterNotifyInfo : void** optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。