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

UnRegisterForPrintAsyncNotifications

関数
印刷の非同期通知受信の登録を解除する。
DLLwinspool.drv呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// winspool.drv
#include <windows.h>

HRESULT UnRegisterForPrintAsyncNotifications(
    HANDLE param0
);

パラメーター

名前方向説明
param0HANDLEinRegisterForPrintAsyncNotificationsで取得した登録ハンドル。

戻り値の型: HRESULT

各言語での呼び出し定義

// winspool.drv
#include <windows.h>

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

UnRegisterForPrintAsyncNotifications = ctypes.windll.LoadLibrary("winspool.drv").UnRegisterForPrintAsyncNotifications
UnRegisterForPrintAsyncNotifications.restype = ctypes.c_int
UnRegisterForPrintAsyncNotifications.argtypes = [
    wintypes.HANDLE,  # param0 : HANDLE
]
require 'fiddle'
require 'fiddle/import'

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

var (
	winspool_drv = windows.NewLazySystemDLL("winspool.drv")
	procUnRegisterForPrintAsyncNotifications = winspool_drv.NewProc("UnRegisterForPrintAsyncNotifications")
)

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

extern "winspool.drv" fn UnRegisterForPrintAsyncNotifications(
    param0: ?*anyopaque // HANDLE
) callconv(std.os.windows.WINAPI) i32;
proc UnRegisterForPrintAsyncNotifications(
    param0: pointer  # HANDLE
): int32 {.importc: "UnRegisterForPrintAsyncNotifications", stdcall, dynlib: "winspool.drv".}
pragma(lib, "winspool.drv");
extern(Windows)
int UnRegisterForPrintAsyncNotifications(
    void* param0   // HANDLE
);
ccall((:UnRegisterForPrintAsyncNotifications, "winspool.drv"), stdcall, Int32,
      (Ptr{Cvoid},),
      param0)
# param0 : HANDLE -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t UnRegisterForPrintAsyncNotifications(
    void* param0);
]]
local winspool.drv = ffi.load("winspool.drv")
-- winspool.drv.UnRegisterForPrintAsyncNotifications(param0)
-- param0 : HANDLE
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('winspool.drv');
const UnRegisterForPrintAsyncNotifications = lib.func('__stdcall', 'UnRegisterForPrintAsyncNotifications', 'int32_t', ['void *']);
// UnRegisterForPrintAsyncNotifications(param0)
// param0 : HANDLE -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("winspool.drv", {
  UnRegisterForPrintAsyncNotifications: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.UnRegisterForPrintAsyncNotifications(param0)
// param0 : HANDLE -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t UnRegisterForPrintAsyncNotifications(
    void* param0);
C, "winspool.drv");
// $ffi->UnRegisterForPrintAsyncNotifications(param0);
// param0 : 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 Winspool.drv extends StdCallLibrary {
    Winspool.drv INSTANCE = Native.load("winspool.drv", Winspool.drv.class);
    int UnRegisterForPrintAsyncNotifications(
        Pointer param0   // HANDLE
    );
}
@[Link("winspool.drv")]
lib Libwinspool.drv
  fun UnRegisterForPrintAsyncNotifications = UnRegisterForPrintAsyncNotifications(
    param0 : 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 UnRegisterForPrintAsyncNotificationsNative = Int32 Function(Pointer<Void>);
typedef UnRegisterForPrintAsyncNotificationsDart = int Function(Pointer<Void>);
final UnRegisterForPrintAsyncNotifications = DynamicLibrary.open('winspool.drv')
    .lookupFunction<UnRegisterForPrintAsyncNotificationsNative, UnRegisterForPrintAsyncNotificationsDart>('UnRegisterForPrintAsyncNotifications');
// param0 : HANDLE -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function UnRegisterForPrintAsyncNotifications(
  param0: THandle   // HANDLE
): Integer; stdcall;
  external 'winspool.drv' name 'UnRegisterForPrintAsyncNotifications';
import Foreign
import Foreign.C.Types
import Foreign.C.String

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

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

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