ホーム › Graphics.Printing › RouterCreatePrintAsyncNotificationChannel
RouterCreatePrintAsyncNotificationChannel
関数ルーター経由で印刷非同期通知チャネルを作成する。
シグネチャ
// SPOOLSS.dll
#include <windows.h>
HRESULT RouterCreatePrintAsyncNotificationChannel(
LPCWSTR pName,
GUID* pNotificationType,
PrintAsyncNotifyUserFilter eNotifyFilter,
PrintAsyncNotifyConversationStyle eConversationStyle,
IPrintAsyncNotifyCallback* pCallback,
IPrintAsyncNotifyChannel** ppIAsynchNotification
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pName | LPCWSTR | in |
| pNotificationType | GUID* | in |
| eNotifyFilter | PrintAsyncNotifyUserFilter | in |
| eConversationStyle | PrintAsyncNotifyConversationStyle | in |
| pCallback | IPrintAsyncNotifyCallback* | in |
| ppIAsynchNotification | IPrintAsyncNotifyChannel** | out |
戻り値の型: 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 方式にも切替可。#uselib "SPOOLSS.dll" #cfunc global RouterCreatePrintAsyncNotificationChannel "RouterCreatePrintAsyncNotificationChannel" wstr, sptr, int, int, sptr, sptr ; res = RouterCreatePrintAsyncNotificationChannel(pName, varptr(pNotificationType), eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification) ; pName : LPCWSTR -> "wstr" ; pNotificationType : GUID* -> "sptr" ; eNotifyFilter : PrintAsyncNotifyUserFilter -> "int" ; eConversationStyle : PrintAsyncNotifyConversationStyle -> "int" ; pCallback : IPrintAsyncNotifyCallback* -> "sptr" ; ppIAsynchNotification : IPrintAsyncNotifyChannel** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; HRESULT RouterCreatePrintAsyncNotificationChannel(LPCWSTR pName, GUID* pNotificationType, PrintAsyncNotifyUserFilter eNotifyFilter, PrintAsyncNotifyConversationStyle eConversationStyle, IPrintAsyncNotifyCallback* pCallback, IPrintAsyncNotifyChannel** ppIAsynchNotification) #uselib "SPOOLSS.dll" #cfunc global RouterCreatePrintAsyncNotificationChannel "RouterCreatePrintAsyncNotificationChannel" wstr, intptr, int, int, intptr, intptr ; res = RouterCreatePrintAsyncNotificationChannel(pName, varptr(pNotificationType), eNotifyFilter, eConversationStyle, pCallback, ppIAsynchNotification) ; pName : LPCWSTR -> "wstr" ; pNotificationType : GUID* -> "intptr" ; eNotifyFilter : PrintAsyncNotifyUserFilter -> "int" ; eConversationStyle : PrintAsyncNotifyConversationStyle -> "int" ; pCallback : IPrintAsyncNotifyCallback* -> "intptr" ; ppIAsynchNotification : IPrintAsyncNotifyChannel** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // HRESULTfunction 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)。