ホーム › Graphics.Printing.PrintTicket › PTGetPrintDeviceResources
PTGetPrintDeviceResources
関数印刷デバイスのリソース情報を取得する。
シグネチャ
// prntvpt.dll
#include <windows.h>
HRESULT PTGetPrintDeviceResources(
HPTPROVIDER hProvider,
LPCWSTR pszLocaleName,
IStream* pPrintTicket, // optional
IStream* pDeviceResources,
LPWSTR* pbstrErrorMessage // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hProvider | HPTPROVIDER | in |
| pszLocaleName | LPCWSTR | in |
| pPrintTicket | IStream* | inoptional |
| pDeviceResources | IStream* | in |
| pbstrErrorMessage | LPWSTR* | outoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// prntvpt.dll
#include <windows.h>
HRESULT PTGetPrintDeviceResources(
HPTPROVIDER hProvider,
LPCWSTR pszLocaleName,
IStream* pPrintTicket, // optional
IStream* pDeviceResources,
LPWSTR* pbstrErrorMessage // optional
);[DllImport("prntvpt.dll", ExactSpelling = true)]
static extern int PTGetPrintDeviceResources(
IntPtr hProvider, // HPTPROVIDER
[MarshalAs(UnmanagedType.LPWStr)] string pszLocaleName, // LPCWSTR
IntPtr pPrintTicket, // IStream* optional
IntPtr pDeviceResources, // IStream*
IntPtr pbstrErrorMessage // LPWSTR* optional, out
);<DllImport("prntvpt.dll", ExactSpelling:=True)>
Public Shared Function PTGetPrintDeviceResources(
hProvider As IntPtr, ' HPTPROVIDER
<MarshalAs(UnmanagedType.LPWStr)> pszLocaleName As String, ' LPCWSTR
pPrintTicket As IntPtr, ' IStream* optional
pDeviceResources As IntPtr, ' IStream*
pbstrErrorMessage As IntPtr ' LPWSTR* optional, out
) As Integer
End Function' hProvider : HPTPROVIDER
' pszLocaleName : LPCWSTR
' pPrintTicket : IStream* optional
' pDeviceResources : IStream*
' pbstrErrorMessage : LPWSTR* optional, out
Declare PtrSafe Function PTGetPrintDeviceResources Lib "prntvpt" ( _
ByVal hProvider As LongPtr, _
ByVal pszLocaleName As LongPtr, _
ByVal pPrintTicket As LongPtr, _
ByVal pDeviceResources As LongPtr, _
ByVal pbstrErrorMessage As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PTGetPrintDeviceResources = ctypes.windll.prntvpt.PTGetPrintDeviceResources
PTGetPrintDeviceResources.restype = ctypes.c_int
PTGetPrintDeviceResources.argtypes = [
wintypes.HANDLE, # hProvider : HPTPROVIDER
wintypes.LPCWSTR, # pszLocaleName : LPCWSTR
ctypes.c_void_p, # pPrintTicket : IStream* optional
ctypes.c_void_p, # pDeviceResources : IStream*
ctypes.c_void_p, # pbstrErrorMessage : LPWSTR* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('prntvpt.dll')
PTGetPrintDeviceResources = Fiddle::Function.new(
lib['PTGetPrintDeviceResources'],
[
Fiddle::TYPE_VOIDP, # hProvider : HPTPROVIDER
Fiddle::TYPE_VOIDP, # pszLocaleName : LPCWSTR
Fiddle::TYPE_VOIDP, # pPrintTicket : IStream* optional
Fiddle::TYPE_VOIDP, # pDeviceResources : IStream*
Fiddle::TYPE_VOIDP, # pbstrErrorMessage : LPWSTR* optional, out
],
Fiddle::TYPE_INT)#[link(name = "prntvpt")]
extern "system" {
fn PTGetPrintDeviceResources(
hProvider: *mut core::ffi::c_void, // HPTPROVIDER
pszLocaleName: *const u16, // LPCWSTR
pPrintTicket: *mut core::ffi::c_void, // IStream* optional
pDeviceResources: *mut core::ffi::c_void, // IStream*
pbstrErrorMessage: *mut *mut u16 // LPWSTR* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("prntvpt.dll")]
public static extern int PTGetPrintDeviceResources(IntPtr hProvider, [MarshalAs(UnmanagedType.LPWStr)] string pszLocaleName, IntPtr pPrintTicket, IntPtr pDeviceResources, IntPtr pbstrErrorMessage);
"@
$api = Add-Type -MemberDefinition $sig -Name 'prntvpt_PTGetPrintDeviceResources' -Namespace Win32 -PassThru
# $api::PTGetPrintDeviceResources(hProvider, pszLocaleName, pPrintTicket, pDeviceResources, pbstrErrorMessage)#uselib "prntvpt.dll"
#func global PTGetPrintDeviceResources "PTGetPrintDeviceResources" sptr, sptr, sptr, sptr, sptr
; PTGetPrintDeviceResources hProvider, pszLocaleName, pPrintTicket, pDeviceResources, varptr(pbstrErrorMessage) ; 戻り値は stat
; hProvider : HPTPROVIDER -> "sptr"
; pszLocaleName : LPCWSTR -> "sptr"
; pPrintTicket : IStream* optional -> "sptr"
; pDeviceResources : IStream* -> "sptr"
; pbstrErrorMessage : LPWSTR* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "prntvpt.dll" #cfunc global PTGetPrintDeviceResources "PTGetPrintDeviceResources" sptr, wstr, sptr, sptr, var ; res = PTGetPrintDeviceResources(hProvider, pszLocaleName, pPrintTicket, pDeviceResources, pbstrErrorMessage) ; hProvider : HPTPROVIDER -> "sptr" ; pszLocaleName : LPCWSTR -> "wstr" ; pPrintTicket : IStream* optional -> "sptr" ; pDeviceResources : IStream* -> "sptr" ; pbstrErrorMessage : LPWSTR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "prntvpt.dll" #cfunc global PTGetPrintDeviceResources "PTGetPrintDeviceResources" sptr, wstr, sptr, sptr, sptr ; res = PTGetPrintDeviceResources(hProvider, pszLocaleName, pPrintTicket, pDeviceResources, varptr(pbstrErrorMessage)) ; hProvider : HPTPROVIDER -> "sptr" ; pszLocaleName : LPCWSTR -> "wstr" ; pPrintTicket : IStream* optional -> "sptr" ; pDeviceResources : IStream* -> "sptr" ; pbstrErrorMessage : LPWSTR* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT PTGetPrintDeviceResources(HPTPROVIDER hProvider, LPCWSTR pszLocaleName, IStream* pPrintTicket, IStream* pDeviceResources, LPWSTR* pbstrErrorMessage) #uselib "prntvpt.dll" #cfunc global PTGetPrintDeviceResources "PTGetPrintDeviceResources" intptr, wstr, intptr, intptr, var ; res = PTGetPrintDeviceResources(hProvider, pszLocaleName, pPrintTicket, pDeviceResources, pbstrErrorMessage) ; hProvider : HPTPROVIDER -> "intptr" ; pszLocaleName : LPCWSTR -> "wstr" ; pPrintTicket : IStream* optional -> "intptr" ; pDeviceResources : IStream* -> "intptr" ; pbstrErrorMessage : LPWSTR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT PTGetPrintDeviceResources(HPTPROVIDER hProvider, LPCWSTR pszLocaleName, IStream* pPrintTicket, IStream* pDeviceResources, LPWSTR* pbstrErrorMessage) #uselib "prntvpt.dll" #cfunc global PTGetPrintDeviceResources "PTGetPrintDeviceResources" intptr, wstr, intptr, intptr, intptr ; res = PTGetPrintDeviceResources(hProvider, pszLocaleName, pPrintTicket, pDeviceResources, varptr(pbstrErrorMessage)) ; hProvider : HPTPROVIDER -> "intptr" ; pszLocaleName : LPCWSTR -> "wstr" ; pPrintTicket : IStream* optional -> "intptr" ; pDeviceResources : IStream* -> "intptr" ; pbstrErrorMessage : LPWSTR* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
prntvpt = windows.NewLazySystemDLL("prntvpt.dll")
procPTGetPrintDeviceResources = prntvpt.NewProc("PTGetPrintDeviceResources")
)
// hProvider (HPTPROVIDER), pszLocaleName (LPCWSTR), pPrintTicket (IStream* optional), pDeviceResources (IStream*), pbstrErrorMessage (LPWSTR* optional, out)
r1, _, err := procPTGetPrintDeviceResources.Call(
uintptr(hProvider),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszLocaleName))),
uintptr(pPrintTicket),
uintptr(pDeviceResources),
uintptr(pbstrErrorMessage),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction PTGetPrintDeviceResources(
hProvider: THandle; // HPTPROVIDER
pszLocaleName: PWideChar; // LPCWSTR
pPrintTicket: Pointer; // IStream* optional
pDeviceResources: Pointer; // IStream*
pbstrErrorMessage: PPWideChar // LPWSTR* optional, out
): Integer; stdcall;
external 'prntvpt.dll' name 'PTGetPrintDeviceResources';result := DllCall("prntvpt\PTGetPrintDeviceResources"
, "Ptr", hProvider ; HPTPROVIDER
, "WStr", pszLocaleName ; LPCWSTR
, "Ptr", pPrintTicket ; IStream* optional
, "Ptr", pDeviceResources ; IStream*
, "Ptr", pbstrErrorMessage ; LPWSTR* optional, out
, "Int") ; return: HRESULT●PTGetPrintDeviceResources(hProvider, pszLocaleName, pPrintTicket, pDeviceResources, pbstrErrorMessage) = DLL("prntvpt.dll", "int PTGetPrintDeviceResources(void*, char*, void*, void*, void*)")
# 呼び出し: PTGetPrintDeviceResources(hProvider, pszLocaleName, pPrintTicket, pDeviceResources, pbstrErrorMessage)
# hProvider : HPTPROVIDER -> "void*"
# pszLocaleName : LPCWSTR -> "char*"
# pPrintTicket : IStream* optional -> "void*"
# pDeviceResources : IStream* -> "void*"
# pbstrErrorMessage : LPWSTR* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。