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

RouterCreatePrintAsyncNotificationChannel

関数
ルーター経由で印刷非同期通知チャネルを作成する。
DLLSPOOLSS.dll呼出規約winapi

シグネチャ

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

HRESULT RouterCreatePrintAsyncNotificationChannel(
    LPCWSTR pName,
    GUID* pNotificationType,
    PrintAsyncNotifyUserFilter eNotifyFilter,
    PrintAsyncNotifyConversationStyle eConversationStyle,
    IPrintAsyncNotifyCallback* pCallback,
    IPrintAsyncNotifyChannel** ppIAsynchNotification
);

パラメーター

名前方向説明
pNameLPCWSTRin通知チャネルを作成する対象のプリンタ名を示す文字列(Unicode)。
pNotificationTypeGUID*in送受信する通知種別を識別するGUIDへのポインタ。
eNotifyFilterPrintAsyncNotifyUserFilterin通知対象ユーザーを絞るPrintAsyncNotifyUserFilter列挙値。
eConversationStylePrintAsyncNotifyConversationStylein双方向か一方向かを示すPrintAsyncNotifyConversationStyle列挙値。
pCallbackIPrintAsyncNotifyCallback*in通知受信時に呼ばれるIPrintAsyncNotifyCallbackインターフェース。
ppIAsynchNotificationIPrintAsyncNotifyChannel**out生成された通知チャネルIPrintAsyncNotifyChannelを受け取るポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT RouterCreatePrintAsyncNotificationChannel(
    LPCWSTR pName,
    GUID* pNotificationType,
    PrintAsyncNotifyUserFilter eNotifyFilter,
    PrintAsyncNotifyConversationStyle eConversationStyle,
    IPrintAsyncNotifyCallback* pCallback,
    IPrintAsyncNotifyChannel** ppIAsynchNotification
);
[DllImport("SPOOLSS.dll", ExactSpelling = true)]
static extern int RouterCreatePrintAsyncNotificationChannel(
    [MarshalAs(UnmanagedType.LPWStr)] string pName,   // LPCWSTR
    ref Guid pNotificationType,   // GUID*
    int eNotifyFilter,   // PrintAsyncNotifyUserFilter
    int eConversationStyle,   // PrintAsyncNotifyConversationStyle
    IntPtr pCallback,   // IPrintAsyncNotifyCallback*
    IntPtr ppIAsynchNotification   // IPrintAsyncNotifyChannel** out
);
<DllImport("SPOOLSS.dll", ExactSpelling:=True)>
Public Shared Function RouterCreatePrintAsyncNotificationChannel(
    <MarshalAs(UnmanagedType.LPWStr)> pName As String,   ' LPCWSTR
    ByRef pNotificationType As Guid,   ' GUID*
    eNotifyFilter As Integer,   ' PrintAsyncNotifyUserFilter
    eConversationStyle As Integer,   ' PrintAsyncNotifyConversationStyle
    pCallback As IntPtr,   ' IPrintAsyncNotifyCallback*
    ppIAsynchNotification As IntPtr   ' IPrintAsyncNotifyChannel** out
) As Integer
End Function
' pName : LPCWSTR
' pNotificationType : GUID*
' eNotifyFilter : PrintAsyncNotifyUserFilter
' eConversationStyle : PrintAsyncNotifyConversationStyle
' pCallback : IPrintAsyncNotifyCallback*
' ppIAsynchNotification : IPrintAsyncNotifyChannel** out
Declare PtrSafe Function RouterCreatePrintAsyncNotificationChannel Lib "spoolss" ( _
    ByVal pName As LongPtr, _
    ByVal pNotificationType As LongPtr, _
    ByVal eNotifyFilter As Long, _
    ByVal eConversationStyle As Long, _
    ByVal pCallback As LongPtr, _
    ByVal ppIAsynchNotification As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RouterCreatePrintAsyncNotificationChannel = ctypes.windll.spoolss.RouterCreatePrintAsyncNotificationChannel
RouterCreatePrintAsyncNotificationChannel.restype = ctypes.c_int
RouterCreatePrintAsyncNotificationChannel.argtypes = [
    wintypes.LPCWSTR,  # pName : LPCWSTR
    ctypes.c_void_p,  # pNotificationType : GUID*
    ctypes.c_int,  # eNotifyFilter : PrintAsyncNotifyUserFilter
    ctypes.c_int,  # eConversationStyle : PrintAsyncNotifyConversationStyle
    ctypes.c_void_p,  # pCallback : IPrintAsyncNotifyCallback*
    ctypes.c_void_p,  # ppIAsynchNotification : IPrintAsyncNotifyChannel** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SPOOLSS.dll')
RouterCreatePrintAsyncNotificationChannel = Fiddle::Function.new(
  lib['RouterCreatePrintAsyncNotificationChannel'],
  [
    Fiddle::TYPE_VOIDP,  # pName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pNotificationType : GUID*
    Fiddle::TYPE_INT,  # eNotifyFilter : PrintAsyncNotifyUserFilter
    Fiddle::TYPE_INT,  # eConversationStyle : PrintAsyncNotifyConversationStyle
    Fiddle::TYPE_VOIDP,  # pCallback : IPrintAsyncNotifyCallback*
    Fiddle::TYPE_VOIDP,  # ppIAsynchNotification : IPrintAsyncNotifyChannel** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "spoolss")]
extern "system" {
    fn RouterCreatePrintAsyncNotificationChannel(
        pName: *const u16,  // LPCWSTR
        pNotificationType: *mut GUID,  // GUID*
        eNotifyFilter: i32,  // PrintAsyncNotifyUserFilter
        eConversationStyle: i32,  // PrintAsyncNotifyConversationStyle
        pCallback: *mut core::ffi::c_void,  // IPrintAsyncNotifyCallback*
        ppIAsynchNotification: *mut *mut core::ffi::c_void  // IPrintAsyncNotifyChannel** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SPOOLSS.dll")]
public static extern int RouterCreatePrintAsyncNotificationChannel([MarshalAs(UnmanagedType.LPWStr)] string pName, ref Guid pNotificationType, int eNotifyFilter, int eConversationStyle, IntPtr pCallback, IntPtr ppIAsynchNotification);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SPOOLSS_RouterCreatePrintAsyncNotificationChannel' -Namespace Win32 -PassThru
# $api::RouterCreatePrintAsyncNotificationChannel(pName, pNotificationType, eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification)
#uselib "SPOOLSS.dll"
#func global RouterCreatePrintAsyncNotificationChannel "RouterCreatePrintAsyncNotificationChannel" sptr, sptr, sptr, sptr, sptr, sptr
; RouterCreatePrintAsyncNotificationChannel pName, varptr(pNotificationType), eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification   ; 戻り値は stat
; pName : LPCWSTR -> "sptr"
; pNotificationType : GUID* -> "sptr"
; eNotifyFilter : PrintAsyncNotifyUserFilter -> "sptr"
; eConversationStyle : PrintAsyncNotifyConversationStyle -> "sptr"
; pCallback : IPrintAsyncNotifyCallback* -> "sptr"
; ppIAsynchNotification : IPrintAsyncNotifyChannel** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "SPOOLSS.dll"
#cfunc global RouterCreatePrintAsyncNotificationChannel "RouterCreatePrintAsyncNotificationChannel" wstr, var, int, int, sptr, sptr
; res = RouterCreatePrintAsyncNotificationChannel(pName, pNotificationType, eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification)
; pName : LPCWSTR -> "wstr"
; pNotificationType : GUID* -> "var"
; eNotifyFilter : PrintAsyncNotifyUserFilter -> "int"
; eConversationStyle : PrintAsyncNotifyConversationStyle -> "int"
; pCallback : IPrintAsyncNotifyCallback* -> "sptr"
; ppIAsynchNotification : IPrintAsyncNotifyChannel** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT RouterCreatePrintAsyncNotificationChannel(LPCWSTR pName, GUID* pNotificationType, PrintAsyncNotifyUserFilter eNotifyFilter, PrintAsyncNotifyConversationStyle eConversationStyle, IPrintAsyncNotifyCallback* pCallback, IPrintAsyncNotifyChannel** ppIAsynchNotification)
#uselib "SPOOLSS.dll"
#cfunc global RouterCreatePrintAsyncNotificationChannel "RouterCreatePrintAsyncNotificationChannel" wstr, var, int, int, intptr, intptr
; res = RouterCreatePrintAsyncNotificationChannel(pName, pNotificationType, eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification)
; pName : LPCWSTR -> "wstr"
; pNotificationType : GUID* -> "var"
; eNotifyFilter : PrintAsyncNotifyUserFilter -> "int"
; eConversationStyle : PrintAsyncNotifyConversationStyle -> "int"
; pCallback : IPrintAsyncNotifyCallback* -> "intptr"
; ppIAsynchNotification : IPrintAsyncNotifyChannel** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	spoolss = windows.NewLazySystemDLL("SPOOLSS.dll")
	procRouterCreatePrintAsyncNotificationChannel = spoolss.NewProc("RouterCreatePrintAsyncNotificationChannel")
)

// pName (LPCWSTR), pNotificationType (GUID*), eNotifyFilter (PrintAsyncNotifyUserFilter), eConversationStyle (PrintAsyncNotifyConversationStyle), pCallback (IPrintAsyncNotifyCallback*), ppIAsynchNotification (IPrintAsyncNotifyChannel** out)
r1, _, err := procRouterCreatePrintAsyncNotificationChannel.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pName))),
	uintptr(pNotificationType),
	uintptr(eNotifyFilter),
	uintptr(eConversationStyle),
	uintptr(pCallback),
	uintptr(ppIAsynchNotification),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function RouterCreatePrintAsyncNotificationChannel(
  pName: PWideChar;   // LPCWSTR
  pNotificationType: PGUID;   // GUID*
  eNotifyFilter: Integer;   // PrintAsyncNotifyUserFilter
  eConversationStyle: Integer;   // PrintAsyncNotifyConversationStyle
  pCallback: Pointer;   // IPrintAsyncNotifyCallback*
  ppIAsynchNotification: Pointer   // IPrintAsyncNotifyChannel** out
): Integer; stdcall;
  external 'SPOOLSS.dll' name 'RouterCreatePrintAsyncNotificationChannel';
result := DllCall("SPOOLSS\RouterCreatePrintAsyncNotificationChannel"
    , "WStr", pName   ; LPCWSTR
    , "Ptr", pNotificationType   ; GUID*
    , "Int", eNotifyFilter   ; PrintAsyncNotifyUserFilter
    , "Int", eConversationStyle   ; PrintAsyncNotifyConversationStyle
    , "Ptr", pCallback   ; IPrintAsyncNotifyCallback*
    , "Ptr", ppIAsynchNotification   ; IPrintAsyncNotifyChannel** out
    , "Int")   ; return: HRESULT
●RouterCreatePrintAsyncNotificationChannel(pName, pNotificationType, eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification) = DLL("SPOOLSS.dll", "int RouterCreatePrintAsyncNotificationChannel(char*, void*, int, int, void*, void*)")
# 呼び出し: RouterCreatePrintAsyncNotificationChannel(pName, pNotificationType, eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification)
# pName : LPCWSTR -> "char*"
# pNotificationType : GUID* -> "void*"
# eNotifyFilter : PrintAsyncNotifyUserFilter -> "int"
# eConversationStyle : PrintAsyncNotifyConversationStyle -> "int"
# pCallback : IPrintAsyncNotifyCallback* -> "void*"
# ppIAsynchNotification : IPrintAsyncNotifyChannel** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "spoolss" fn RouterCreatePrintAsyncNotificationChannel(
    pName: [*c]const u16, // LPCWSTR
    pNotificationType: [*c]GUID, // GUID*
    eNotifyFilter: i32, // PrintAsyncNotifyUserFilter
    eConversationStyle: i32, // PrintAsyncNotifyConversationStyle
    pCallback: ?*anyopaque, // IPrintAsyncNotifyCallback*
    ppIAsynchNotification: ?*anyopaque // IPrintAsyncNotifyChannel** out
) callconv(std.os.windows.WINAPI) i32;
proc RouterCreatePrintAsyncNotificationChannel(
    pName: WideCString,  # LPCWSTR
    pNotificationType: ptr GUID,  # GUID*
    eNotifyFilter: int32,  # PrintAsyncNotifyUserFilter
    eConversationStyle: int32,  # PrintAsyncNotifyConversationStyle
    pCallback: pointer,  # IPrintAsyncNotifyCallback*
    ppIAsynchNotification: pointer  # IPrintAsyncNotifyChannel** out
): int32 {.importc: "RouterCreatePrintAsyncNotificationChannel", stdcall, dynlib: "SPOOLSS.dll".}
pragma(lib, "spoolss");
extern(Windows)
int RouterCreatePrintAsyncNotificationChannel(
    const(wchar)* pName,   // LPCWSTR
    GUID* pNotificationType,   // GUID*
    int eNotifyFilter,   // PrintAsyncNotifyUserFilter
    int eConversationStyle,   // PrintAsyncNotifyConversationStyle
    void* pCallback,   // IPrintAsyncNotifyCallback*
    void* ppIAsynchNotification   // IPrintAsyncNotifyChannel** out
);
ccall((:RouterCreatePrintAsyncNotificationChannel, "SPOOLSS.dll"), stdcall, Int32,
      (Cwstring, Ptr{GUID}, Int32, Int32, Ptr{Cvoid}, Ptr{Cvoid}),
      pName, pNotificationType, eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification)
# pName : LPCWSTR -> Cwstring
# pNotificationType : GUID* -> Ptr{GUID}
# eNotifyFilter : PrintAsyncNotifyUserFilter -> Int32
# eConversationStyle : PrintAsyncNotifyConversationStyle -> Int32
# pCallback : IPrintAsyncNotifyCallback* -> Ptr{Cvoid}
# ppIAsynchNotification : IPrintAsyncNotifyChannel** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t RouterCreatePrintAsyncNotificationChannel(
    const uint16_t* pName,
    void* pNotificationType,
    int32_t eNotifyFilter,
    int32_t eConversationStyle,
    void* pCallback,
    void* ppIAsynchNotification);
]]
local spoolss = ffi.load("spoolss")
-- spoolss.RouterCreatePrintAsyncNotificationChannel(pName, pNotificationType, eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification)
-- pName : LPCWSTR
-- pNotificationType : GUID*
-- eNotifyFilter : PrintAsyncNotifyUserFilter
-- eConversationStyle : PrintAsyncNotifyConversationStyle
-- pCallback : IPrintAsyncNotifyCallback*
-- ppIAsynchNotification : IPrintAsyncNotifyChannel** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('SPOOLSS.dll');
const RouterCreatePrintAsyncNotificationChannel = lib.func('__stdcall', 'RouterCreatePrintAsyncNotificationChannel', 'int32_t', ['str16', 'void *', 'int32_t', 'int32_t', 'void *', 'void *']);
// RouterCreatePrintAsyncNotificationChannel(pName, pNotificationType, eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification)
// pName : LPCWSTR -> 'str16'
// pNotificationType : GUID* -> 'void *'
// eNotifyFilter : PrintAsyncNotifyUserFilter -> 'int32_t'
// eConversationStyle : PrintAsyncNotifyConversationStyle -> 'int32_t'
// pCallback : IPrintAsyncNotifyCallback* -> 'void *'
// ppIAsynchNotification : IPrintAsyncNotifyChannel** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("SPOOLSS.dll", {
  RouterCreatePrintAsyncNotificationChannel: { parameters: ["buffer", "pointer", "i32", "i32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.RouterCreatePrintAsyncNotificationChannel(pName, pNotificationType, eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification)
// pName : LPCWSTR -> "buffer"
// pNotificationType : GUID* -> "pointer"
// eNotifyFilter : PrintAsyncNotifyUserFilter -> "i32"
// eConversationStyle : PrintAsyncNotifyConversationStyle -> "i32"
// pCallback : IPrintAsyncNotifyCallback* -> "pointer"
// ppIAsynchNotification : IPrintAsyncNotifyChannel** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t RouterCreatePrintAsyncNotificationChannel(
    const uint16_t* pName,
    void* pNotificationType,
    int32_t eNotifyFilter,
    int32_t eConversationStyle,
    void* pCallback,
    void* ppIAsynchNotification);
C, "SPOOLSS.dll");
// $ffi->RouterCreatePrintAsyncNotificationChannel(pName, pNotificationType, eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification);
// pName : LPCWSTR
// pNotificationType : GUID*
// eNotifyFilter : PrintAsyncNotifyUserFilter
// eConversationStyle : PrintAsyncNotifyConversationStyle
// pCallback : IPrintAsyncNotifyCallback*
// ppIAsynchNotification : IPrintAsyncNotifyChannel** 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);
    int RouterCreatePrintAsyncNotificationChannel(
        WString pName,   // LPCWSTR
        Pointer pNotificationType,   // GUID*
        int eNotifyFilter,   // PrintAsyncNotifyUserFilter
        int eConversationStyle,   // PrintAsyncNotifyConversationStyle
        Pointer pCallback,   // IPrintAsyncNotifyCallback*
        Pointer ppIAsynchNotification   // IPrintAsyncNotifyChannel** out
    );
}
@[Link("spoolss")]
lib LibSPOOLSS
  fun RouterCreatePrintAsyncNotificationChannel = RouterCreatePrintAsyncNotificationChannel(
    pName : UInt16*,   # LPCWSTR
    pNotificationType : GUID*,   # GUID*
    eNotifyFilter : Int32,   # PrintAsyncNotifyUserFilter
    eConversationStyle : Int32,   # PrintAsyncNotifyConversationStyle
    pCallback : Void*,   # IPrintAsyncNotifyCallback*
    ppIAsynchNotification : Void*   # IPrintAsyncNotifyChannel** out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef RouterCreatePrintAsyncNotificationChannelNative = Int32 Function(Pointer<Utf16>, Pointer<Void>, Int32, Int32, Pointer<Void>, Pointer<Void>);
typedef RouterCreatePrintAsyncNotificationChannelDart = int Function(Pointer<Utf16>, Pointer<Void>, int, int, Pointer<Void>, Pointer<Void>);
final RouterCreatePrintAsyncNotificationChannel = DynamicLibrary.open('SPOOLSS.dll')
    .lookupFunction<RouterCreatePrintAsyncNotificationChannelNative, RouterCreatePrintAsyncNotificationChannelDart>('RouterCreatePrintAsyncNotificationChannel');
// pName : LPCWSTR -> Pointer<Utf16>
// pNotificationType : GUID* -> Pointer<Void>
// eNotifyFilter : PrintAsyncNotifyUserFilter -> Int32
// eConversationStyle : PrintAsyncNotifyConversationStyle -> Int32
// pCallback : IPrintAsyncNotifyCallback* -> Pointer<Void>
// ppIAsynchNotification : IPrintAsyncNotifyChannel** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function RouterCreatePrintAsyncNotificationChannel(
  pName: PWideChar;   // LPCWSTR
  pNotificationType: PGUID;   // GUID*
  eNotifyFilter: Integer;   // PrintAsyncNotifyUserFilter
  eConversationStyle: Integer;   // PrintAsyncNotifyConversationStyle
  pCallback: Pointer;   // IPrintAsyncNotifyCallback*
  ppIAsynchNotification: Pointer   // IPrintAsyncNotifyChannel** out
): Integer; stdcall;
  external 'SPOOLSS.dll' name 'RouterCreatePrintAsyncNotificationChannel';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RouterCreatePrintAsyncNotificationChannel"
  c_RouterCreatePrintAsyncNotificationChannel :: CWString -> Ptr () -> Int32 -> Int32 -> Ptr () -> Ptr () -> IO Int32
-- pName : LPCWSTR -> CWString
-- pNotificationType : GUID* -> Ptr ()
-- eNotifyFilter : PrintAsyncNotifyUserFilter -> Int32
-- eConversationStyle : PrintAsyncNotifyConversationStyle -> Int32
-- pCallback : IPrintAsyncNotifyCallback* -> Ptr ()
-- ppIAsynchNotification : IPrintAsyncNotifyChannel** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let routercreateprintasyncnotificationchannel =
  foreign "RouterCreatePrintAsyncNotificationChannel"
    ((ptr uint16_t) @-> (ptr void) @-> int32_t @-> int32_t @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* pName : LPCWSTR -> (ptr uint16_t) *)
(* pNotificationType : GUID* -> (ptr void) *)
(* eNotifyFilter : PrintAsyncNotifyUserFilter -> int32_t *)
(* eConversationStyle : PrintAsyncNotifyConversationStyle -> int32_t *)
(* pCallback : IPrintAsyncNotifyCallback* -> (ptr void) *)
(* ppIAsynchNotification : IPrintAsyncNotifyChannel** 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 ("RouterCreatePrintAsyncNotificationChannel" router-create-print-async-notification-channel :convention :stdcall) :int32
  (p-name (:string :encoding :utf-16le))   ; LPCWSTR
  (p-notification-type :pointer)   ; GUID*
  (e-notify-filter :int32)   ; PrintAsyncNotifyUserFilter
  (e-conversation-style :int32)   ; PrintAsyncNotifyConversationStyle
  (p-callback :pointer)   ; IPrintAsyncNotifyCallback*
  (pp-iasynch-notification :pointer))   ; IPrintAsyncNotifyChannel** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RouterCreatePrintAsyncNotificationChannel = Win32::API::More->new('SPOOLSS',
    'int RouterCreatePrintAsyncNotificationChannel(LPCWSTR pName, LPVOID pNotificationType, int eNotifyFilter, int eConversationStyle, LPVOID pCallback, LPVOID ppIAsynchNotification)');
# my $ret = $RouterCreatePrintAsyncNotificationChannel->Call($pName, $pNotificationType, $eNotifyFilter, $eConversationStyle, $pCallback, $ppIAsynchNotification);
# pName : LPCWSTR -> LPCWSTR
# pNotificationType : GUID* -> LPVOID
# eNotifyFilter : PrintAsyncNotifyUserFilter -> int
# eConversationStyle : PrintAsyncNotifyConversationStyle -> int
# pCallback : IPrintAsyncNotifyCallback* -> LPVOID
# ppIAsynchNotification : IPrintAsyncNotifyChannel** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型