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

RouterUnregisterForPrintAsyncNotifications

関数
ルーター経由の印刷非同期通知登録を解除する。
DLLSPOOLSS.dll呼出規約winapi

シグネチャ

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

HRESULT RouterUnregisterForPrintAsyncNotifications(
    HANDLE hNotify
);

パラメーター

名前方向説明
hNotifyHANDLEinルーター経由で取得した非同期通知登録ハンドル。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

RouterUnregisterForPrintAsyncNotifications = ctypes.windll.spoolss.RouterUnregisterForPrintAsyncNotifications
RouterUnregisterForPrintAsyncNotifications.restype = ctypes.c_int
RouterUnregisterForPrintAsyncNotifications.argtypes = [
    wintypes.HANDLE,  # hNotify : HANDLE
]
require 'fiddle'
require 'fiddle/import'

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

var (
	spoolss = windows.NewLazySystemDLL("SPOOLSS.dll")
	procRouterUnregisterForPrintAsyncNotifications = spoolss.NewProc("RouterUnregisterForPrintAsyncNotifications")
)

// hNotify (HANDLE)
r1, _, err := procRouterUnregisterForPrintAsyncNotifications.Call(
	uintptr(hNotify),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function RouterUnregisterForPrintAsyncNotifications(
  hNotify: THandle   // HANDLE
): Integer; stdcall;
  external 'SPOOLSS.dll' name 'RouterUnregisterForPrintAsyncNotifications';
result := DllCall("SPOOLSS\RouterUnregisterForPrintAsyncNotifications"
    , "Ptr", hNotify   ; HANDLE
    , "Int")   ; return: HRESULT
●RouterUnregisterForPrintAsyncNotifications(hNotify) = DLL("SPOOLSS.dll", "int RouterUnregisterForPrintAsyncNotifications(void*)")
# 呼び出し: RouterUnregisterForPrintAsyncNotifications(hNotify)
# hNotify : HANDLE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef RouterUnregisterForPrintAsyncNotificationsNative = Int32 Function(Pointer<Void>);
typedef RouterUnregisterForPrintAsyncNotificationsDart = int Function(Pointer<Void>);
final RouterUnregisterForPrintAsyncNotifications = DynamicLibrary.open('SPOOLSS.dll')
    .lookupFunction<RouterUnregisterForPrintAsyncNotificationsNative, RouterUnregisterForPrintAsyncNotificationsDart>('RouterUnregisterForPrintAsyncNotifications');
// hNotify : HANDLE -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function RouterUnregisterForPrintAsyncNotifications(
  hNotify: THandle   // HANDLE
): Integer; stdcall;
  external 'SPOOLSS.dll' name 'RouterUnregisterForPrintAsyncNotifications';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RouterUnregisterForPrintAsyncNotifications"
  c_RouterUnregisterForPrintAsyncNotifications :: Ptr () -> IO Int32
-- hNotify : HANDLE -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let routerunregisterforprintasyncnotifications =
  foreign "RouterUnregisterForPrintAsyncNotifications"
    ((ptr void) @-> returning int32_t)
(* hNotify : HANDLE -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library spoolss (t "SPOOLSS.dll"))
(cffi:use-foreign-library spoolss)

(cffi:defcfun ("RouterUnregisterForPrintAsyncNotifications" router-unregister-for-print-async-notifications :convention :stdcall) :int32
  (h-notify :pointer))   ; HANDLE
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RouterUnregisterForPrintAsyncNotifications = Win32::API::More->new('SPOOLSS',
    'int RouterUnregisterForPrintAsyncNotifications(HANDLE hNotify)');
# my $ret = $RouterUnregisterForPrintAsyncNotifications->Call($hNotify);
# hNotify : HANDLE -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。