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

SpoolerRefreshPrinterChangeNotification

関数
スプーラーのプリンター変更通知情報を更新する。
DLLSPOOLSS.dll呼出規約winapi

シグネチャ

// SPOOLSS.dll
#include <windows.h>

BOOL SpoolerRefreshPrinterChangeNotification(
    PRINTER_HANDLE hPrinter,
    DWORD dwColor,
    PRINTER_NOTIFY_OPTIONS* pOptions,
    PRINTER_NOTIFY_INFO** ppInfo   // optional
);

パラメーター

名前方向
hPrinterPRINTER_HANDLEin
dwColorDWORDin
pOptionsPRINTER_NOTIFY_OPTIONS*in
ppInfoPRINTER_NOTIFY_INFO**inoutoptional

戻り値の型: BOOL

各言語での呼び出し定義

// SPOOLSS.dll
#include <windows.h>

BOOL SpoolerRefreshPrinterChangeNotification(
    PRINTER_HANDLE hPrinter,
    DWORD dwColor,
    PRINTER_NOTIFY_OPTIONS* pOptions,
    PRINTER_NOTIFY_INFO** ppInfo   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SPOOLSS.dll", ExactSpelling = true)]
static extern bool SpoolerRefreshPrinterChangeNotification(
    PRINTER_HANDLE hPrinter,   // PRINTER_HANDLE
    uint dwColor,   // DWORD
    IntPtr pOptions,   // PRINTER_NOTIFY_OPTIONS*
    IntPtr ppInfo   // PRINTER_NOTIFY_INFO** optional, in/out
);
<DllImport("SPOOLSS.dll", ExactSpelling:=True)>
Public Shared Function SpoolerRefreshPrinterChangeNotification(
    hPrinter As PRINTER_HANDLE,   ' PRINTER_HANDLE
    dwColor As UInteger,   ' DWORD
    pOptions As IntPtr,   ' PRINTER_NOTIFY_OPTIONS*
    ppInfo As IntPtr   ' PRINTER_NOTIFY_INFO** optional, in/out
) As Boolean
End Function
' hPrinter : PRINTER_HANDLE
' dwColor : DWORD
' pOptions : PRINTER_NOTIFY_OPTIONS*
' ppInfo : PRINTER_NOTIFY_INFO** optional, in/out
Declare PtrSafe Function SpoolerRefreshPrinterChangeNotification Lib "spoolss" ( _
    ByVal hPrinter As LongPtr, _
    ByVal dwColor As Long, _
    ByVal pOptions As LongPtr, _
    ByVal ppInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SpoolerRefreshPrinterChangeNotification = ctypes.windll.spoolss.SpoolerRefreshPrinterChangeNotification
SpoolerRefreshPrinterChangeNotification.restype = wintypes.BOOL
SpoolerRefreshPrinterChangeNotification.argtypes = [
    PRINTER_HANDLE,  # hPrinter : PRINTER_HANDLE
    wintypes.DWORD,  # dwColor : DWORD
    ctypes.c_void_p,  # pOptions : PRINTER_NOTIFY_OPTIONS*
    ctypes.c_void_p,  # ppInfo : PRINTER_NOTIFY_INFO** optional, in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	spoolss = windows.NewLazySystemDLL("SPOOLSS.dll")
	procSpoolerRefreshPrinterChangeNotification = spoolss.NewProc("SpoolerRefreshPrinterChangeNotification")
)

// hPrinter (PRINTER_HANDLE), dwColor (DWORD), pOptions (PRINTER_NOTIFY_OPTIONS*), ppInfo (PRINTER_NOTIFY_INFO** optional, in/out)
r1, _, err := procSpoolerRefreshPrinterChangeNotification.Call(
	uintptr(hPrinter),
	uintptr(dwColor),
	uintptr(pOptions),
	uintptr(ppInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SpoolerRefreshPrinterChangeNotification(
  hPrinter: PRINTER_HANDLE;   // PRINTER_HANDLE
  dwColor: DWORD;   // DWORD
  pOptions: Pointer;   // PRINTER_NOTIFY_OPTIONS*
  ppInfo: Pointer   // PRINTER_NOTIFY_INFO** optional, in/out
): BOOL; stdcall;
  external 'SPOOLSS.dll' name 'SpoolerRefreshPrinterChangeNotification';
result := DllCall("SPOOLSS\SpoolerRefreshPrinterChangeNotification"
    , "Ptr", hPrinter   ; PRINTER_HANDLE
    , "UInt", dwColor   ; DWORD
    , "Ptr", pOptions   ; PRINTER_NOTIFY_OPTIONS*
    , "Ptr", ppInfo   ; PRINTER_NOTIFY_INFO** optional, in/out
    , "Int")   ; return: BOOL
●SpoolerRefreshPrinterChangeNotification(hPrinter, dwColor, pOptions, ppInfo) = DLL("SPOOLSS.dll", "bool SpoolerRefreshPrinterChangeNotification(void*, dword, void*, void*)")
# 呼び出し: SpoolerRefreshPrinterChangeNotification(hPrinter, dwColor, pOptions, ppInfo)
# hPrinter : PRINTER_HANDLE -> "void*"
# dwColor : DWORD -> "dword"
# pOptions : PRINTER_NOTIFY_OPTIONS* -> "void*"
# ppInfo : PRINTER_NOTIFY_INFO** optional, in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。