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

RouterAllocPrinterNotifyInfo

関数
プリンター通知情報構造体をルーターで確保する。
DLLSPOOLSS.dll呼出規約winapi

シグネチャ

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

PRINTER_NOTIFY_INFO* RouterAllocPrinterNotifyInfo(
    DWORD cPrinterNotifyInfoData
);

パラメーター

名前方向
cPrinterNotifyInfoDataDWORDin

戻り値の型: PRINTER_NOTIFY_INFO*

各言語での呼び出し定義

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

PRINTER_NOTIFY_INFO* RouterAllocPrinterNotifyInfo(
    DWORD cPrinterNotifyInfoData
);
[DllImport("SPOOLSS.dll", ExactSpelling = true)]
static extern IntPtr RouterAllocPrinterNotifyInfo(
    uint cPrinterNotifyInfoData   // DWORD
);
<DllImport("SPOOLSS.dll", ExactSpelling:=True)>
Public Shared Function RouterAllocPrinterNotifyInfo(
    cPrinterNotifyInfoData As UInteger   ' DWORD
) As IntPtr
End Function
' cPrinterNotifyInfoData : DWORD
Declare PtrSafe Function RouterAllocPrinterNotifyInfo Lib "spoolss" ( _
    ByVal cPrinterNotifyInfoData As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RouterAllocPrinterNotifyInfo = ctypes.windll.spoolss.RouterAllocPrinterNotifyInfo
RouterAllocPrinterNotifyInfo.restype = ctypes.c_void_p
RouterAllocPrinterNotifyInfo.argtypes = [
    wintypes.DWORD,  # cPrinterNotifyInfoData : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SPOOLSS.dll')
RouterAllocPrinterNotifyInfo = Fiddle::Function.new(
  lib['RouterAllocPrinterNotifyInfo'],
  [
    -Fiddle::TYPE_INT,  # cPrinterNotifyInfoData : DWORD
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "spoolss")]
extern "system" {
    fn RouterAllocPrinterNotifyInfo(
        cPrinterNotifyInfoData: u32  // DWORD
    ) -> *mut PRINTER_NOTIFY_INFO;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("SPOOLSS.dll")]
public static extern IntPtr RouterAllocPrinterNotifyInfo(uint cPrinterNotifyInfoData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SPOOLSS_RouterAllocPrinterNotifyInfo' -Namespace Win32 -PassThru
# $api::RouterAllocPrinterNotifyInfo(cPrinterNotifyInfoData)
#uselib "SPOOLSS.dll"
#func global RouterAllocPrinterNotifyInfo "RouterAllocPrinterNotifyInfo" sptr
; RouterAllocPrinterNotifyInfo cPrinterNotifyInfoData   ; 戻り値は stat
; cPrinterNotifyInfoData : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SPOOLSS.dll"
#cfunc global RouterAllocPrinterNotifyInfo "RouterAllocPrinterNotifyInfo" int
; res = RouterAllocPrinterNotifyInfo(cPrinterNotifyInfoData)
; cPrinterNotifyInfoData : DWORD -> "int"
; PRINTER_NOTIFY_INFO* RouterAllocPrinterNotifyInfo(DWORD cPrinterNotifyInfoData)
#uselib "SPOOLSS.dll"
#cfunc global RouterAllocPrinterNotifyInfo "RouterAllocPrinterNotifyInfo" int
; res = RouterAllocPrinterNotifyInfo(cPrinterNotifyInfoData)
; cPrinterNotifyInfoData : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	spoolss = windows.NewLazySystemDLL("SPOOLSS.dll")
	procRouterAllocPrinterNotifyInfo = spoolss.NewProc("RouterAllocPrinterNotifyInfo")
)

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