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