ホーム › Graphics.Printing › UpdatePrintDeviceObject
UpdatePrintDeviceObject
関数印刷デバイスオブジェクトを更新する。
シグネチャ
// SPOOLSS.dll
#include <windows.h>
HRESULT UpdatePrintDeviceObject(
PRINTER_HANDLE hPrinter,
HANDLE hDeviceObject
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hPrinter | PRINTER_HANDLE | in |
| hDeviceObject | HANDLE | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// SPOOLSS.dll
#include <windows.h>
HRESULT UpdatePrintDeviceObject(
PRINTER_HANDLE hPrinter,
HANDLE hDeviceObject
);[DllImport("SPOOLSS.dll", ExactSpelling = true)]
static extern int UpdatePrintDeviceObject(
PRINTER_HANDLE hPrinter, // PRINTER_HANDLE
IntPtr hDeviceObject // HANDLE
);<DllImport("SPOOLSS.dll", ExactSpelling:=True)>
Public Shared Function UpdatePrintDeviceObject(
hPrinter As PRINTER_HANDLE, ' PRINTER_HANDLE
hDeviceObject As IntPtr ' HANDLE
) As Integer
End Function' hPrinter : PRINTER_HANDLE
' hDeviceObject : HANDLE
Declare PtrSafe Function UpdatePrintDeviceObject Lib "spoolss" ( _
ByVal hPrinter As LongPtr, _
ByVal hDeviceObject As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
UpdatePrintDeviceObject = ctypes.windll.spoolss.UpdatePrintDeviceObject
UpdatePrintDeviceObject.restype = ctypes.c_int
UpdatePrintDeviceObject.argtypes = [
PRINTER_HANDLE, # hPrinter : PRINTER_HANDLE
wintypes.HANDLE, # hDeviceObject : HANDLE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SPOOLSS.dll')
UpdatePrintDeviceObject = Fiddle::Function.new(
lib['UpdatePrintDeviceObject'],
[
Fiddle::TYPE_VOIDP, # hPrinter : PRINTER_HANDLE
Fiddle::TYPE_VOIDP, # hDeviceObject : HANDLE
],
Fiddle::TYPE_INT)#[link(name = "spoolss")]
extern "system" {
fn UpdatePrintDeviceObject(
hPrinter: PRINTER_HANDLE, // PRINTER_HANDLE
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 UpdatePrintDeviceObject(PRINTER_HANDLE hPrinter, IntPtr hDeviceObject);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SPOOLSS_UpdatePrintDeviceObject' -Namespace Win32 -PassThru
# $api::UpdatePrintDeviceObject(hPrinter, hDeviceObject)#uselib "SPOOLSS.dll"
#func global UpdatePrintDeviceObject "UpdatePrintDeviceObject" sptr, sptr
; UpdatePrintDeviceObject hPrinter, hDeviceObject ; 戻り値は stat
; hPrinter : PRINTER_HANDLE -> "sptr"
; hDeviceObject : HANDLE -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "SPOOLSS.dll"
#cfunc global UpdatePrintDeviceObject "UpdatePrintDeviceObject" int, sptr
; res = UpdatePrintDeviceObject(hPrinter, hDeviceObject)
; hPrinter : PRINTER_HANDLE -> "int"
; hDeviceObject : HANDLE -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。; HRESULT UpdatePrintDeviceObject(PRINTER_HANDLE hPrinter, HANDLE hDeviceObject)
#uselib "SPOOLSS.dll"
#cfunc global UpdatePrintDeviceObject "UpdatePrintDeviceObject" int, intptr
; res = UpdatePrintDeviceObject(hPrinter, hDeviceObject)
; hPrinter : PRINTER_HANDLE -> "int"
; hDeviceObject : HANDLE -> "intptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
spoolss = windows.NewLazySystemDLL("SPOOLSS.dll")
procUpdatePrintDeviceObject = spoolss.NewProc("UpdatePrintDeviceObject")
)
// hPrinter (PRINTER_HANDLE), hDeviceObject (HANDLE)
r1, _, err := procUpdatePrintDeviceObject.Call(
uintptr(hPrinter),
uintptr(hDeviceObject),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction UpdatePrintDeviceObject(
hPrinter: PRINTER_HANDLE; // PRINTER_HANDLE
hDeviceObject: THandle // HANDLE
): Integer; stdcall;
external 'SPOOLSS.dll' name 'UpdatePrintDeviceObject';result := DllCall("SPOOLSS\UpdatePrintDeviceObject"
, "Ptr", hPrinter ; PRINTER_HANDLE
, "Ptr", hDeviceObject ; HANDLE
, "Int") ; return: HRESULT●UpdatePrintDeviceObject(hPrinter, hDeviceObject) = DLL("SPOOLSS.dll", "int UpdatePrintDeviceObject(void*, void*)")
# 呼び出し: UpdatePrintDeviceObject(hPrinter, hDeviceObject)
# hPrinter : PRINTER_HANDLE -> "void*"
# hDeviceObject : HANDLE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。