ホーム › Graphics.Printing › CallRouterFindFirstPrinterChangeNotification
CallRouterFindFirstPrinterChangeNotification
関数ルーター経由でプリンター変更通知の監視を開始する。
シグネチャ
// SPOOLSS.dll
#include <windows.h>
DWORD CallRouterFindFirstPrinterChangeNotification(
HANDLE hPrinterRPC,
DWORD fdwFilterFlags,
DWORD fdwOptions,
HANDLE hNotify,
PRINTER_NOTIFY_OPTIONS* pPrinterNotifyOptions
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hPrinterRPC | HANDLE | in |
| fdwFilterFlags | DWORD | in |
| fdwOptions | DWORD | in |
| hNotify | HANDLE | in |
| pPrinterNotifyOptions | PRINTER_NOTIFY_OPTIONS* | in |
戻り値の型: DWORD
各言語での呼び出し定義
// SPOOLSS.dll
#include <windows.h>
DWORD CallRouterFindFirstPrinterChangeNotification(
HANDLE hPrinterRPC,
DWORD fdwFilterFlags,
DWORD fdwOptions,
HANDLE hNotify,
PRINTER_NOTIFY_OPTIONS* pPrinterNotifyOptions
);[DllImport("SPOOLSS.dll", ExactSpelling = true)]
static extern uint CallRouterFindFirstPrinterChangeNotification(
IntPtr hPrinterRPC, // HANDLE
uint fdwFilterFlags, // DWORD
uint fdwOptions, // DWORD
IntPtr hNotify, // HANDLE
IntPtr pPrinterNotifyOptions // PRINTER_NOTIFY_OPTIONS*
);<DllImport("SPOOLSS.dll", ExactSpelling:=True)>
Public Shared Function CallRouterFindFirstPrinterChangeNotification(
hPrinterRPC As IntPtr, ' HANDLE
fdwFilterFlags As UInteger, ' DWORD
fdwOptions As UInteger, ' DWORD
hNotify As IntPtr, ' HANDLE
pPrinterNotifyOptions As IntPtr ' PRINTER_NOTIFY_OPTIONS*
) As UInteger
End Function' hPrinterRPC : HANDLE
' fdwFilterFlags : DWORD
' fdwOptions : DWORD
' hNotify : HANDLE
' pPrinterNotifyOptions : PRINTER_NOTIFY_OPTIONS*
Declare PtrSafe Function CallRouterFindFirstPrinterChangeNotification Lib "spoolss" ( _
ByVal hPrinterRPC As LongPtr, _
ByVal fdwFilterFlags As Long, _
ByVal fdwOptions As Long, _
ByVal hNotify As LongPtr, _
ByVal pPrinterNotifyOptions As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CallRouterFindFirstPrinterChangeNotification = ctypes.windll.spoolss.CallRouterFindFirstPrinterChangeNotification
CallRouterFindFirstPrinterChangeNotification.restype = wintypes.DWORD
CallRouterFindFirstPrinterChangeNotification.argtypes = [
wintypes.HANDLE, # hPrinterRPC : HANDLE
wintypes.DWORD, # fdwFilterFlags : DWORD
wintypes.DWORD, # fdwOptions : DWORD
wintypes.HANDLE, # hNotify : HANDLE
ctypes.c_void_p, # pPrinterNotifyOptions : PRINTER_NOTIFY_OPTIONS*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SPOOLSS.dll')
CallRouterFindFirstPrinterChangeNotification = Fiddle::Function.new(
lib['CallRouterFindFirstPrinterChangeNotification'],
[
Fiddle::TYPE_VOIDP, # hPrinterRPC : HANDLE
-Fiddle::TYPE_INT, # fdwFilterFlags : DWORD
-Fiddle::TYPE_INT, # fdwOptions : DWORD
Fiddle::TYPE_VOIDP, # hNotify : HANDLE
Fiddle::TYPE_VOIDP, # pPrinterNotifyOptions : PRINTER_NOTIFY_OPTIONS*
],
-Fiddle::TYPE_INT)#[link(name = "spoolss")]
extern "system" {
fn CallRouterFindFirstPrinterChangeNotification(
hPrinterRPC: *mut core::ffi::c_void, // HANDLE
fdwFilterFlags: u32, // DWORD
fdwOptions: u32, // DWORD
hNotify: *mut core::ffi::c_void, // HANDLE
pPrinterNotifyOptions: *mut PRINTER_NOTIFY_OPTIONS // PRINTER_NOTIFY_OPTIONS*
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("SPOOLSS.dll")]
public static extern uint CallRouterFindFirstPrinterChangeNotification(IntPtr hPrinterRPC, uint fdwFilterFlags, uint fdwOptions, IntPtr hNotify, IntPtr pPrinterNotifyOptions);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SPOOLSS_CallRouterFindFirstPrinterChangeNotification' -Namespace Win32 -PassThru
# $api::CallRouterFindFirstPrinterChangeNotification(hPrinterRPC, fdwFilterFlags, fdwOptions, hNotify, pPrinterNotifyOptions)#uselib "SPOOLSS.dll"
#func global CallRouterFindFirstPrinterChangeNotification "CallRouterFindFirstPrinterChangeNotification" sptr, sptr, sptr, sptr, sptr
; CallRouterFindFirstPrinterChangeNotification hPrinterRPC, fdwFilterFlags, fdwOptions, hNotify, varptr(pPrinterNotifyOptions) ; 戻り値は stat
; hPrinterRPC : HANDLE -> "sptr"
; fdwFilterFlags : DWORD -> "sptr"
; fdwOptions : DWORD -> "sptr"
; hNotify : HANDLE -> "sptr"
; pPrinterNotifyOptions : PRINTER_NOTIFY_OPTIONS* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SPOOLSS.dll" #cfunc global CallRouterFindFirstPrinterChangeNotification "CallRouterFindFirstPrinterChangeNotification" sptr, int, int, sptr, var ; res = CallRouterFindFirstPrinterChangeNotification(hPrinterRPC, fdwFilterFlags, fdwOptions, hNotify, pPrinterNotifyOptions) ; hPrinterRPC : HANDLE -> "sptr" ; fdwFilterFlags : DWORD -> "int" ; fdwOptions : DWORD -> "int" ; hNotify : HANDLE -> "sptr" ; pPrinterNotifyOptions : PRINTER_NOTIFY_OPTIONS* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SPOOLSS.dll" #cfunc global CallRouterFindFirstPrinterChangeNotification "CallRouterFindFirstPrinterChangeNotification" sptr, int, int, sptr, sptr ; res = CallRouterFindFirstPrinterChangeNotification(hPrinterRPC, fdwFilterFlags, fdwOptions, hNotify, varptr(pPrinterNotifyOptions)) ; hPrinterRPC : HANDLE -> "sptr" ; fdwFilterFlags : DWORD -> "int" ; fdwOptions : DWORD -> "int" ; hNotify : HANDLE -> "sptr" ; pPrinterNotifyOptions : PRINTER_NOTIFY_OPTIONS* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD CallRouterFindFirstPrinterChangeNotification(HANDLE hPrinterRPC, DWORD fdwFilterFlags, DWORD fdwOptions, HANDLE hNotify, PRINTER_NOTIFY_OPTIONS* pPrinterNotifyOptions) #uselib "SPOOLSS.dll" #cfunc global CallRouterFindFirstPrinterChangeNotification "CallRouterFindFirstPrinterChangeNotification" intptr, int, int, intptr, var ; res = CallRouterFindFirstPrinterChangeNotification(hPrinterRPC, fdwFilterFlags, fdwOptions, hNotify, pPrinterNotifyOptions) ; hPrinterRPC : HANDLE -> "intptr" ; fdwFilterFlags : DWORD -> "int" ; fdwOptions : DWORD -> "int" ; hNotify : HANDLE -> "intptr" ; pPrinterNotifyOptions : PRINTER_NOTIFY_OPTIONS* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD CallRouterFindFirstPrinterChangeNotification(HANDLE hPrinterRPC, DWORD fdwFilterFlags, DWORD fdwOptions, HANDLE hNotify, PRINTER_NOTIFY_OPTIONS* pPrinterNotifyOptions) #uselib "SPOOLSS.dll" #cfunc global CallRouterFindFirstPrinterChangeNotification "CallRouterFindFirstPrinterChangeNotification" intptr, int, int, intptr, intptr ; res = CallRouterFindFirstPrinterChangeNotification(hPrinterRPC, fdwFilterFlags, fdwOptions, hNotify, varptr(pPrinterNotifyOptions)) ; hPrinterRPC : HANDLE -> "intptr" ; fdwFilterFlags : DWORD -> "int" ; fdwOptions : DWORD -> "int" ; hNotify : HANDLE -> "intptr" ; pPrinterNotifyOptions : PRINTER_NOTIFY_OPTIONS* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
spoolss = windows.NewLazySystemDLL("SPOOLSS.dll")
procCallRouterFindFirstPrinterChangeNotification = spoolss.NewProc("CallRouterFindFirstPrinterChangeNotification")
)
// hPrinterRPC (HANDLE), fdwFilterFlags (DWORD), fdwOptions (DWORD), hNotify (HANDLE), pPrinterNotifyOptions (PRINTER_NOTIFY_OPTIONS*)
r1, _, err := procCallRouterFindFirstPrinterChangeNotification.Call(
uintptr(hPrinterRPC),
uintptr(fdwFilterFlags),
uintptr(fdwOptions),
uintptr(hNotify),
uintptr(pPrinterNotifyOptions),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction CallRouterFindFirstPrinterChangeNotification(
hPrinterRPC: THandle; // HANDLE
fdwFilterFlags: DWORD; // DWORD
fdwOptions: DWORD; // DWORD
hNotify: THandle; // HANDLE
pPrinterNotifyOptions: Pointer // PRINTER_NOTIFY_OPTIONS*
): DWORD; stdcall;
external 'SPOOLSS.dll' name 'CallRouterFindFirstPrinterChangeNotification';result := DllCall("SPOOLSS\CallRouterFindFirstPrinterChangeNotification"
, "Ptr", hPrinterRPC ; HANDLE
, "UInt", fdwFilterFlags ; DWORD
, "UInt", fdwOptions ; DWORD
, "Ptr", hNotify ; HANDLE
, "Ptr", pPrinterNotifyOptions ; PRINTER_NOTIFY_OPTIONS*
, "UInt") ; return: DWORD●CallRouterFindFirstPrinterChangeNotification(hPrinterRPC, fdwFilterFlags, fdwOptions, hNotify, pPrinterNotifyOptions) = DLL("SPOOLSS.dll", "dword CallRouterFindFirstPrinterChangeNotification(void*, dword, dword, void*, void*)")
# 呼び出し: CallRouterFindFirstPrinterChangeNotification(hPrinterRPC, fdwFilterFlags, fdwOptions, hNotify, pPrinterNotifyOptions)
# hPrinterRPC : HANDLE -> "void*"
# fdwFilterFlags : DWORD -> "dword"
# fdwOptions : DWORD -> "dword"
# hNotify : HANDLE -> "void*"
# pPrinterNotifyOptions : PRINTER_NOTIFY_OPTIONS* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。