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

RemovePrintDeviceObject

関数
印刷デバイスオブジェクトを削除する。
DLLSPOOLSS.dll呼出規約winapi

シグネチャ

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

HRESULT RemovePrintDeviceObject(
    HANDLE hDeviceObject
);

パラメーター

名前方向
hDeviceObjectHANDLEin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

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

lib = Fiddle.dlopen('SPOOLSS.dll')
RemovePrintDeviceObject = Fiddle::Function.new(
  lib['RemovePrintDeviceObject'],
  [
    Fiddle::TYPE_VOIDP,  # hDeviceObject : HANDLE
  ],
  Fiddle::TYPE_INT)
#[link(name = "spoolss")]
extern "system" {
    fn RemovePrintDeviceObject(
        hDeviceObject: *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 RemovePrintDeviceObject(IntPtr hDeviceObject);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SPOOLSS_RemovePrintDeviceObject' -Namespace Win32 -PassThru
# $api::RemovePrintDeviceObject(hDeviceObject)
#uselib "SPOOLSS.dll"
#func global RemovePrintDeviceObject "RemovePrintDeviceObject" sptr
; RemovePrintDeviceObject hDeviceObject   ; 戻り値は stat
; hDeviceObject : HANDLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "SPOOLSS.dll"
#cfunc global RemovePrintDeviceObject "RemovePrintDeviceObject" sptr
; res = RemovePrintDeviceObject(hDeviceObject)
; hDeviceObject : HANDLE -> "sptr"
; HRESULT RemovePrintDeviceObject(HANDLE hDeviceObject)
#uselib "SPOOLSS.dll"
#cfunc global RemovePrintDeviceObject "RemovePrintDeviceObject" intptr
; res = RemovePrintDeviceObject(hDeviceObject)
; hDeviceObject : HANDLE -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	spoolss = windows.NewLazySystemDLL("SPOOLSS.dll")
	procRemovePrintDeviceObject = spoolss.NewProc("RemovePrintDeviceObject")
)

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