ホーム › Graphics.Printing › SpoolerFindFirstPrinterChangeNotification
SpoolerFindFirstPrinterChangeNotification
関数スプーラーでプリンター変更通知の監視を開始する。
シグネチャ
// SPOOLSS.dll
#include <windows.h>
BOOL SpoolerFindFirstPrinterChangeNotification(
PRINTER_HANDLE hPrinter,
DWORD fdwFilterFlags,
DWORD fdwOptions,
void* pPrinterNotifyOptions,
void* pvReserved, // optional
void* pNotificationConfig,
HANDLE* phNotify, // optional
HANDLE* phEvent // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hPrinter | PRINTER_HANDLE | in | OpenPrinterで取得したプリンタハンドル。 |
| fdwFilterFlags | DWORD | in | 監視する変更種別を指定するフィルタフラグ。 |
| fdwOptions | DWORD | in | 通知オプションを指定するフラグ。 |
| pPrinterNotifyOptions | void* | in | 詳細な監視対象を指定するPRINTER_NOTIFY_OPTIONSへのポインタ。NULL可。 |
| pvReserved | void* | inoptional | 将来用の予約パラメータ。NULLを指定する。 |
| pNotificationConfig | void* | in | 通知設定を指定する構造体へのポインタ。 |
| phNotify | HANDLE* | outoptional | 通知ハンドルを受け取るポインタ。 |
| phEvent | HANDLE* | outoptional | 通知発生を知らせるイベントハンドルを受け取るポインタ。 |
戻り値の型: BOOL
各言語での呼び出し定義
// SPOOLSS.dll
#include <windows.h>
BOOL SpoolerFindFirstPrinterChangeNotification(
PRINTER_HANDLE hPrinter,
DWORD fdwFilterFlags,
DWORD fdwOptions,
void* pPrinterNotifyOptions,
void* pvReserved, // optional
void* pNotificationConfig,
HANDLE* phNotify, // optional
HANDLE* phEvent // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SPOOLSS.dll", ExactSpelling = true)]
static extern bool SpoolerFindFirstPrinterChangeNotification(
PRINTER_HANDLE hPrinter, // PRINTER_HANDLE
uint fdwFilterFlags, // DWORD
uint fdwOptions, // DWORD
IntPtr pPrinterNotifyOptions, // void*
IntPtr pvReserved, // void* optional
IntPtr pNotificationConfig, // void*
IntPtr phNotify, // HANDLE* optional, out
IntPtr phEvent // HANDLE* optional, out
);<DllImport("SPOOLSS.dll", ExactSpelling:=True)>
Public Shared Function SpoolerFindFirstPrinterChangeNotification(
hPrinter As PRINTER_HANDLE, ' PRINTER_HANDLE
fdwFilterFlags As UInteger, ' DWORD
fdwOptions As UInteger, ' DWORD
pPrinterNotifyOptions As IntPtr, ' void*
pvReserved As IntPtr, ' void* optional
pNotificationConfig As IntPtr, ' void*
phNotify As IntPtr, ' HANDLE* optional, out
phEvent As IntPtr ' HANDLE* optional, out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hPrinter : PRINTER_HANDLE
' fdwFilterFlags : DWORD
' fdwOptions : DWORD
' pPrinterNotifyOptions : void*
' pvReserved : void* optional
' pNotificationConfig : void*
' phNotify : HANDLE* optional, out
' phEvent : HANDLE* optional, out
Declare PtrSafe Function SpoolerFindFirstPrinterChangeNotification Lib "spoolss" ( _
ByVal hPrinter As LongPtr, _
ByVal fdwFilterFlags As Long, _
ByVal fdwOptions As Long, _
ByVal pPrinterNotifyOptions As LongPtr, _
ByVal pvReserved As LongPtr, _
ByVal pNotificationConfig As LongPtr, _
ByVal phNotify As LongPtr, _
ByVal phEvent As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SpoolerFindFirstPrinterChangeNotification = ctypes.windll.spoolss.SpoolerFindFirstPrinterChangeNotification
SpoolerFindFirstPrinterChangeNotification.restype = wintypes.BOOL
SpoolerFindFirstPrinterChangeNotification.argtypes = [
PRINTER_HANDLE, # hPrinter : PRINTER_HANDLE
wintypes.DWORD, # fdwFilterFlags : DWORD
wintypes.DWORD, # fdwOptions : DWORD
ctypes.POINTER(None), # pPrinterNotifyOptions : void*
ctypes.POINTER(None), # pvReserved : void* optional
ctypes.POINTER(None), # pNotificationConfig : void*
ctypes.c_void_p, # phNotify : HANDLE* optional, out
ctypes.c_void_p, # phEvent : HANDLE* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SPOOLSS.dll')
SpoolerFindFirstPrinterChangeNotification = Fiddle::Function.new(
lib['SpoolerFindFirstPrinterChangeNotification'],
[
Fiddle::TYPE_VOIDP, # hPrinter : PRINTER_HANDLE
-Fiddle::TYPE_INT, # fdwFilterFlags : DWORD
-Fiddle::TYPE_INT, # fdwOptions : DWORD
Fiddle::TYPE_VOIDP, # pPrinterNotifyOptions : void*
Fiddle::TYPE_VOIDP, # pvReserved : void* optional
Fiddle::TYPE_VOIDP, # pNotificationConfig : void*
Fiddle::TYPE_VOIDP, # phNotify : HANDLE* optional, out
Fiddle::TYPE_VOIDP, # phEvent : HANDLE* optional, out
],
Fiddle::TYPE_INT)#[link(name = "spoolss")]
extern "system" {
fn SpoolerFindFirstPrinterChangeNotification(
hPrinter: PRINTER_HANDLE, // PRINTER_HANDLE
fdwFilterFlags: u32, // DWORD
fdwOptions: u32, // DWORD
pPrinterNotifyOptions: *mut (), // void*
pvReserved: *mut (), // void* optional
pNotificationConfig: *mut (), // void*
phNotify: *mut *mut core::ffi::c_void, // HANDLE* optional, out
phEvent: *mut *mut core::ffi::c_void // HANDLE* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SPOOLSS.dll")]
public static extern bool SpoolerFindFirstPrinterChangeNotification(PRINTER_HANDLE hPrinter, uint fdwFilterFlags, uint fdwOptions, IntPtr pPrinterNotifyOptions, IntPtr pvReserved, IntPtr pNotificationConfig, IntPtr phNotify, IntPtr phEvent);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SPOOLSS_SpoolerFindFirstPrinterChangeNotification' -Namespace Win32 -PassThru
# $api::SpoolerFindFirstPrinterChangeNotification(hPrinter, fdwFilterFlags, fdwOptions, pPrinterNotifyOptions, pvReserved, pNotificationConfig, phNotify, phEvent)#uselib "SPOOLSS.dll"
#func global SpoolerFindFirstPrinterChangeNotification "SpoolerFindFirstPrinterChangeNotification" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; SpoolerFindFirstPrinterChangeNotification hPrinter, fdwFilterFlags, fdwOptions, pPrinterNotifyOptions, pvReserved, pNotificationConfig, phNotify, phEvent ; 戻り値は stat
; hPrinter : PRINTER_HANDLE -> "sptr"
; fdwFilterFlags : DWORD -> "sptr"
; fdwOptions : DWORD -> "sptr"
; pPrinterNotifyOptions : void* -> "sptr"
; pvReserved : void* optional -> "sptr"
; pNotificationConfig : void* -> "sptr"
; phNotify : HANDLE* optional, out -> "sptr"
; phEvent : HANDLE* optional, out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SPOOLSS.dll"
#cfunc global SpoolerFindFirstPrinterChangeNotification "SpoolerFindFirstPrinterChangeNotification" int, int, int, sptr, sptr, sptr, sptr, sptr
; res = SpoolerFindFirstPrinterChangeNotification(hPrinter, fdwFilterFlags, fdwOptions, pPrinterNotifyOptions, pvReserved, pNotificationConfig, phNotify, phEvent)
; hPrinter : PRINTER_HANDLE -> "int"
; fdwFilterFlags : DWORD -> "int"
; fdwOptions : DWORD -> "int"
; pPrinterNotifyOptions : void* -> "sptr"
; pvReserved : void* optional -> "sptr"
; pNotificationConfig : void* -> "sptr"
; phNotify : HANDLE* optional, out -> "sptr"
; phEvent : HANDLE* optional, out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。; BOOL SpoolerFindFirstPrinterChangeNotification(PRINTER_HANDLE hPrinter, DWORD fdwFilterFlags, DWORD fdwOptions, void* pPrinterNotifyOptions, void* pvReserved, void* pNotificationConfig, HANDLE* phNotify, HANDLE* phEvent)
#uselib "SPOOLSS.dll"
#cfunc global SpoolerFindFirstPrinterChangeNotification "SpoolerFindFirstPrinterChangeNotification" int, int, int, intptr, intptr, intptr, intptr, intptr
; res = SpoolerFindFirstPrinterChangeNotification(hPrinter, fdwFilterFlags, fdwOptions, pPrinterNotifyOptions, pvReserved, pNotificationConfig, phNotify, phEvent)
; hPrinter : PRINTER_HANDLE -> "int"
; fdwFilterFlags : DWORD -> "int"
; fdwOptions : DWORD -> "int"
; pPrinterNotifyOptions : void* -> "intptr"
; pvReserved : void* optional -> "intptr"
; pNotificationConfig : void* -> "intptr"
; phNotify : HANDLE* optional, out -> "intptr"
; phEvent : HANDLE* optional, out -> "intptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
spoolss = windows.NewLazySystemDLL("SPOOLSS.dll")
procSpoolerFindFirstPrinterChangeNotification = spoolss.NewProc("SpoolerFindFirstPrinterChangeNotification")
)
// hPrinter (PRINTER_HANDLE), fdwFilterFlags (DWORD), fdwOptions (DWORD), pPrinterNotifyOptions (void*), pvReserved (void* optional), pNotificationConfig (void*), phNotify (HANDLE* optional, out), phEvent (HANDLE* optional, out)
r1, _, err := procSpoolerFindFirstPrinterChangeNotification.Call(
uintptr(hPrinter),
uintptr(fdwFilterFlags),
uintptr(fdwOptions),
uintptr(pPrinterNotifyOptions),
uintptr(pvReserved),
uintptr(pNotificationConfig),
uintptr(phNotify),
uintptr(phEvent),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SpoolerFindFirstPrinterChangeNotification(
hPrinter: PRINTER_HANDLE; // PRINTER_HANDLE
fdwFilterFlags: DWORD; // DWORD
fdwOptions: DWORD; // DWORD
pPrinterNotifyOptions: Pointer; // void*
pvReserved: Pointer; // void* optional
pNotificationConfig: Pointer; // void*
phNotify: Pointer; // HANDLE* optional, out
phEvent: Pointer // HANDLE* optional, out
): BOOL; stdcall;
external 'SPOOLSS.dll' name 'SpoolerFindFirstPrinterChangeNotification';result := DllCall("SPOOLSS\SpoolerFindFirstPrinterChangeNotification"
, "Ptr", hPrinter ; PRINTER_HANDLE
, "UInt", fdwFilterFlags ; DWORD
, "UInt", fdwOptions ; DWORD
, "Ptr", pPrinterNotifyOptions ; void*
, "Ptr", pvReserved ; void* optional
, "Ptr", pNotificationConfig ; void*
, "Ptr", phNotify ; HANDLE* optional, out
, "Ptr", phEvent ; HANDLE* optional, out
, "Int") ; return: BOOL●SpoolerFindFirstPrinterChangeNotification(hPrinter, fdwFilterFlags, fdwOptions, pPrinterNotifyOptions, pvReserved, pNotificationConfig, phNotify, phEvent) = DLL("SPOOLSS.dll", "bool SpoolerFindFirstPrinterChangeNotification(void*, dword, dword, void*, void*, void*, void*, void*)")
# 呼び出し: SpoolerFindFirstPrinterChangeNotification(hPrinter, fdwFilterFlags, fdwOptions, pPrinterNotifyOptions, pvReserved, pNotificationConfig, phNotify, phEvent)
# hPrinter : PRINTER_HANDLE -> "void*"
# fdwFilterFlags : DWORD -> "dword"
# fdwOptions : DWORD -> "dword"
# pPrinterNotifyOptions : void* -> "void*"
# pvReserved : void* optional -> "void*"
# pNotificationConfig : void* -> "void*"
# phNotify : HANDLE* optional, out -> "void*"
# phEvent : HANDLE* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "spoolss" fn SpoolerFindFirstPrinterChangeNotification(
hPrinter: PRINTER_HANDLE, // PRINTER_HANDLE
fdwFilterFlags: u32, // DWORD
fdwOptions: u32, // DWORD
pPrinterNotifyOptions: ?*anyopaque, // void*
pvReserved: ?*anyopaque, // void* optional
pNotificationConfig: ?*anyopaque, // void*
phNotify: ?*anyopaque, // HANDLE* optional, out
phEvent: ?*anyopaque // HANDLE* optional, out
) callconv(std.os.windows.WINAPI) i32;proc SpoolerFindFirstPrinterChangeNotification(
hPrinter: PRINTER_HANDLE, # PRINTER_HANDLE
fdwFilterFlags: uint32, # DWORD
fdwOptions: uint32, # DWORD
pPrinterNotifyOptions: pointer, # void*
pvReserved: pointer, # void* optional
pNotificationConfig: pointer, # void*
phNotify: pointer, # HANDLE* optional, out
phEvent: pointer # HANDLE* optional, out
): int32 {.importc: "SpoolerFindFirstPrinterChangeNotification", stdcall, dynlib: "SPOOLSS.dll".}pragma(lib, "spoolss");
extern(Windows)
int SpoolerFindFirstPrinterChangeNotification(
PRINTER_HANDLE hPrinter, // PRINTER_HANDLE
uint fdwFilterFlags, // DWORD
uint fdwOptions, // DWORD
void* pPrinterNotifyOptions, // void*
void* pvReserved, // void* optional
void* pNotificationConfig, // void*
void* phNotify, // HANDLE* optional, out
void* phEvent // HANDLE* optional, out
);ccall((:SpoolerFindFirstPrinterChangeNotification, "SPOOLSS.dll"), stdcall, Int32,
(PRINTER_HANDLE, UInt32, UInt32, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
hPrinter, fdwFilterFlags, fdwOptions, pPrinterNotifyOptions, pvReserved, pNotificationConfig, phNotify, phEvent)
# hPrinter : PRINTER_HANDLE -> PRINTER_HANDLE
# fdwFilterFlags : DWORD -> UInt32
# fdwOptions : DWORD -> UInt32
# pPrinterNotifyOptions : void* -> Ptr{Cvoid}
# pvReserved : void* optional -> Ptr{Cvoid}
# pNotificationConfig : void* -> Ptr{Cvoid}
# phNotify : HANDLE* optional, out -> Ptr{Cvoid}
# phEvent : HANDLE* optional, out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t SpoolerFindFirstPrinterChangeNotification(
PRINTER_HANDLE hPrinter,
uint32_t fdwFilterFlags,
uint32_t fdwOptions,
void* pPrinterNotifyOptions,
void* pvReserved,
void* pNotificationConfig,
void* phNotify,
void* phEvent);
]]
local spoolss = ffi.load("spoolss")
-- spoolss.SpoolerFindFirstPrinterChangeNotification(hPrinter, fdwFilterFlags, fdwOptions, pPrinterNotifyOptions, pvReserved, pNotificationConfig, phNotify, phEvent)
-- hPrinter : PRINTER_HANDLE
-- fdwFilterFlags : DWORD
-- fdwOptions : DWORD
-- pPrinterNotifyOptions : void*
-- pvReserved : void* optional
-- pNotificationConfig : void*
-- phNotify : HANDLE* optional, out
-- phEvent : HANDLE* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('SPOOLSS.dll');
const SpoolerFindFirstPrinterChangeNotification = lib.func('__stdcall', 'SpoolerFindFirstPrinterChangeNotification', 'int32_t', ['PRINTER_HANDLE', 'uint32_t', 'uint32_t', 'void *', 'void *', 'void *', 'void *', 'void *']);
// SpoolerFindFirstPrinterChangeNotification(hPrinter, fdwFilterFlags, fdwOptions, pPrinterNotifyOptions, pvReserved, pNotificationConfig, phNotify, phEvent)
// hPrinter : PRINTER_HANDLE -> 'PRINTER_HANDLE'
// fdwFilterFlags : DWORD -> 'uint32_t'
// fdwOptions : DWORD -> 'uint32_t'
// pPrinterNotifyOptions : void* -> 'void *'
// pvReserved : void* optional -> 'void *'
// pNotificationConfig : void* -> 'void *'
// phNotify : HANDLE* optional, out -> 'void *'
// phEvent : HANDLE* optional, out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("SPOOLSS.dll", {
SpoolerFindFirstPrinterChangeNotification: { parameters: ["buffer", "u32", "u32", "pointer", "pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.SpoolerFindFirstPrinterChangeNotification(hPrinter, fdwFilterFlags, fdwOptions, pPrinterNotifyOptions, pvReserved, pNotificationConfig, phNotify, phEvent)
// hPrinter : PRINTER_HANDLE -> "buffer"
// fdwFilterFlags : DWORD -> "u32"
// fdwOptions : DWORD -> "u32"
// pPrinterNotifyOptions : void* -> "pointer"
// pvReserved : void* optional -> "pointer"
// pNotificationConfig : void* -> "pointer"
// phNotify : HANDLE* optional, out -> "pointer"
// phEvent : HANDLE* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SpoolerFindFirstPrinterChangeNotification(
PRINTER_HANDLE hPrinter,
uint32_t fdwFilterFlags,
uint32_t fdwOptions,
void* pPrinterNotifyOptions,
void* pvReserved,
void* pNotificationConfig,
void* phNotify,
void* phEvent);
C, "SPOOLSS.dll");
// $ffi->SpoolerFindFirstPrinterChangeNotification(hPrinter, fdwFilterFlags, fdwOptions, pPrinterNotifyOptions, pvReserved, pNotificationConfig, phNotify, phEvent);
// hPrinter : PRINTER_HANDLE
// fdwFilterFlags : DWORD
// fdwOptions : DWORD
// pPrinterNotifyOptions : void*
// pvReserved : void* optional
// pNotificationConfig : void*
// phNotify : HANDLE* optional, out
// phEvent : HANDLE* optional, out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Spoolss extends StdCallLibrary {
Spoolss INSTANCE = Native.load("spoolss", Spoolss.class);
boolean SpoolerFindFirstPrinterChangeNotification(
PRINTER_HANDLE /* extends Structure (by value) */ hPrinter, // PRINTER_HANDLE
int fdwFilterFlags, // DWORD
int fdwOptions, // DWORD
Pointer pPrinterNotifyOptions, // void*
Pointer pvReserved, // void* optional
Pointer pNotificationConfig, // void*
Pointer phNotify, // HANDLE* optional, out
Pointer phEvent // HANDLE* optional, out
);
}@[Link("spoolss")]
lib LibSPOOLSS
fun SpoolerFindFirstPrinterChangeNotification = SpoolerFindFirstPrinterChangeNotification(
hPrinter : PRINTER_HANDLE, # PRINTER_HANDLE
fdwFilterFlags : UInt32, # DWORD
fdwOptions : UInt32, # DWORD
pPrinterNotifyOptions : Void*, # void*
pvReserved : Void*, # void* optional
pNotificationConfig : Void*, # void*
phNotify : Void*, # HANDLE* optional, out
phEvent : Void* # HANDLE* optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SpoolerFindFirstPrinterChangeNotificationNative = Int32 Function(PRINTER_HANDLE, Uint32, Uint32, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef SpoolerFindFirstPrinterChangeNotificationDart = int Function(int, int, int, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>);
final SpoolerFindFirstPrinterChangeNotification = DynamicLibrary.open('SPOOLSS.dll')
.lookupFunction<SpoolerFindFirstPrinterChangeNotificationNative, SpoolerFindFirstPrinterChangeNotificationDart>('SpoolerFindFirstPrinterChangeNotification');
// hPrinter : PRINTER_HANDLE -> PRINTER_HANDLE
// fdwFilterFlags : DWORD -> Uint32
// fdwOptions : DWORD -> Uint32
// pPrinterNotifyOptions : void* -> Pointer<Void>
// pvReserved : void* optional -> Pointer<Void>
// pNotificationConfig : void* -> Pointer<Void>
// phNotify : HANDLE* optional, out -> Pointer<Void>
// phEvent : HANDLE* optional, out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SpoolerFindFirstPrinterChangeNotification(
hPrinter: PRINTER_HANDLE; // PRINTER_HANDLE
fdwFilterFlags: DWORD; // DWORD
fdwOptions: DWORD; // DWORD
pPrinterNotifyOptions: Pointer; // void*
pvReserved: Pointer; // void* optional
pNotificationConfig: Pointer; // void*
phNotify: Pointer; // HANDLE* optional, out
phEvent: Pointer // HANDLE* optional, out
): BOOL; stdcall;
external 'SPOOLSS.dll' name 'SpoolerFindFirstPrinterChangeNotification';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SpoolerFindFirstPrinterChangeNotification"
c_SpoolerFindFirstPrinterChangeNotification :: PRINTER_HANDLE -> Word32 -> Word32 -> Ptr () -> Ptr () -> Ptr () -> Ptr () -> Ptr () -> IO CInt
-- hPrinter : PRINTER_HANDLE -> PRINTER_HANDLE
-- fdwFilterFlags : DWORD -> Word32
-- fdwOptions : DWORD -> Word32
-- pPrinterNotifyOptions : void* -> Ptr ()
-- pvReserved : void* optional -> Ptr ()
-- pNotificationConfig : void* -> Ptr ()
-- phNotify : HANDLE* optional, out -> Ptr ()
-- phEvent : HANDLE* optional, out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
-- ※値渡し構造体は GHC FFI で直接渡せません。Ptr で渡すラッパ(C側)経由にしてください。open Ctypes
open Foreign
let spoolerfindfirstprinterchangenotification =
foreign "SpoolerFindFirstPrinterChangeNotification"
(PRINTER_HANDLE @-> uint32_t @-> uint32_t @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* hPrinter : PRINTER_HANDLE -> PRINTER_HANDLE *)
(* fdwFilterFlags : DWORD -> uint32_t *)
(* fdwOptions : DWORD -> uint32_t *)
(* pPrinterNotifyOptions : void* -> (ptr void) *)
(* pvReserved : void* optional -> (ptr void) *)
(* pNotificationConfig : void* -> (ptr void) *)
(* phNotify : HANDLE* optional, out -> (ptr void) *)
(* phEvent : HANDLE* optional, out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library spoolss (t "SPOOLSS.dll"))
(cffi:use-foreign-library spoolss)
(cffi:defcfun ("SpoolerFindFirstPrinterChangeNotification" spooler-find-first-printer-change-notification :convention :stdcall) :int32
(h-printer (:struct printer-handle)) ; PRINTER_HANDLE
(fdw-filter-flags :uint32) ; DWORD
(fdw-options :uint32) ; DWORD
(p-printer-notify-options :pointer) ; void*
(pv-reserved :pointer) ; void* optional
(p-notification-config :pointer) ; void*
(ph-notify :pointer) ; HANDLE* optional, out
(ph-event :pointer)) ; HANDLE* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SpoolerFindFirstPrinterChangeNotification = Win32::API::More->new('SPOOLSS',
'BOOL SpoolerFindFirstPrinterChangeNotification(LPVOID hPrinter, DWORD fdwFilterFlags, DWORD fdwOptions, LPVOID pPrinterNotifyOptions, LPVOID pvReserved, LPVOID pNotificationConfig, HANDLE phNotify, HANDLE phEvent)');
# my $ret = $SpoolerFindFirstPrinterChangeNotification->Call($hPrinter, $fdwFilterFlags, $fdwOptions, $pPrinterNotifyOptions, $pvReserved, $pNotificationConfig, $phNotify, $phEvent);
# hPrinter : PRINTER_HANDLE -> LPVOID
# fdwFilterFlags : DWORD -> DWORD
# fdwOptions : DWORD -> DWORD
# pPrinterNotifyOptions : void* -> LPVOID
# pvReserved : void* optional -> LPVOID
# pNotificationConfig : void* -> LPVOID
# phNotify : HANDLE* optional, out -> HANDLE
# phEvent : HANDLE* optional, out -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型