ホーム › Graphics.Printing › GetPrintExecutionData
GetPrintExecutionData
関数現在の印刷実行コンテキスト情報を取得する。
シグネチャ
// winspool.drv
#include <windows.h>
BOOL GetPrintExecutionData(
PRINT_EXECUTION_DATA* pData
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pData | PRINT_EXECUTION_DATA* | out | 現在の印刷実行コンテキスト情報を受け取るPRINT_EXECUTION_DATA構造体へのポインタ。 |
戻り値の型: BOOL
各言語での呼び出し定義
// winspool.drv
#include <windows.h>
BOOL GetPrintExecutionData(
PRINT_EXECUTION_DATA* pData
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("winspool.drv", ExactSpelling = true)]
static extern bool GetPrintExecutionData(
IntPtr pData // PRINT_EXECUTION_DATA* out
);<DllImport("winspool.drv", ExactSpelling:=True)>
Public Shared Function GetPrintExecutionData(
pData As IntPtr ' PRINT_EXECUTION_DATA* out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' pData : PRINT_EXECUTION_DATA* out
Declare PtrSafe Function GetPrintExecutionData Lib "winspool.drv" ( _
ByVal pData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetPrintExecutionData = ctypes.windll.LoadLibrary("winspool.drv").GetPrintExecutionData
GetPrintExecutionData.restype = wintypes.BOOL
GetPrintExecutionData.argtypes = [
ctypes.c_void_p, # pData : PRINT_EXECUTION_DATA* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('winspool.drv')
GetPrintExecutionData = Fiddle::Function.new(
lib['GetPrintExecutionData'],
[
Fiddle::TYPE_VOIDP, # pData : PRINT_EXECUTION_DATA* out
],
Fiddle::TYPE_INT)#[link(name = "winspool.drv")]
extern "system" {
fn GetPrintExecutionData(
pData: *mut PRINT_EXECUTION_DATA // PRINT_EXECUTION_DATA* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("winspool.drv")]
public static extern bool GetPrintExecutionData(IntPtr pData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'winspool.drv_GetPrintExecutionData' -Namespace Win32 -PassThru
# $api::GetPrintExecutionData(pData)#uselib "winspool.drv"
#func global GetPrintExecutionData "GetPrintExecutionData" sptr
; GetPrintExecutionData varptr(pData) ; 戻り値は stat
; pData : PRINT_EXECUTION_DATA* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "winspool.drv" #cfunc global GetPrintExecutionData "GetPrintExecutionData" var ; res = GetPrintExecutionData(pData) ; pData : PRINT_EXECUTION_DATA* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "winspool.drv" #cfunc global GetPrintExecutionData "GetPrintExecutionData" sptr ; res = GetPrintExecutionData(varptr(pData)) ; pData : PRINT_EXECUTION_DATA* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetPrintExecutionData(PRINT_EXECUTION_DATA* pData) #uselib "winspool.drv" #cfunc global GetPrintExecutionData "GetPrintExecutionData" var ; res = GetPrintExecutionData(pData) ; pData : PRINT_EXECUTION_DATA* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetPrintExecutionData(PRINT_EXECUTION_DATA* pData) #uselib "winspool.drv" #cfunc global GetPrintExecutionData "GetPrintExecutionData" intptr ; res = GetPrintExecutionData(varptr(pData)) ; pData : PRINT_EXECUTION_DATA* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winspool_drv = windows.NewLazySystemDLL("winspool.drv")
procGetPrintExecutionData = winspool_drv.NewProc("GetPrintExecutionData")
)
// pData (PRINT_EXECUTION_DATA* out)
r1, _, err := procGetPrintExecutionData.Call(
uintptr(pData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetPrintExecutionData(
pData: Pointer // PRINT_EXECUTION_DATA* out
): BOOL; stdcall;
external 'winspool.drv' name 'GetPrintExecutionData';result := DllCall("winspool.drv\GetPrintExecutionData"
, "Ptr", pData ; PRINT_EXECUTION_DATA* out
, "Int") ; return: BOOL●GetPrintExecutionData(pData) = DLL("winspool.drv", "bool GetPrintExecutionData(void*)")
# 呼び出し: GetPrintExecutionData(pData)
# pData : PRINT_EXECUTION_DATA* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "winspool.drv" fn GetPrintExecutionData(
pData: [*c]PRINT_EXECUTION_DATA // PRINT_EXECUTION_DATA* out
) callconv(std.os.windows.WINAPI) i32;proc GetPrintExecutionData(
pData: ptr PRINT_EXECUTION_DATA # PRINT_EXECUTION_DATA* out
): int32 {.importc: "GetPrintExecutionData", stdcall, dynlib: "winspool.drv".}pragma(lib, "winspool.drv");
extern(Windows)
int GetPrintExecutionData(
PRINT_EXECUTION_DATA* pData // PRINT_EXECUTION_DATA* out
);ccall((:GetPrintExecutionData, "winspool.drv"), stdcall, Int32,
(Ptr{PRINT_EXECUTION_DATA},),
pData)
# pData : PRINT_EXECUTION_DATA* out -> Ptr{PRINT_EXECUTION_DATA}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GetPrintExecutionData(
void* pData);
]]
local winspool.drv = ffi.load("winspool.drv")
-- winspool.drv.GetPrintExecutionData(pData)
-- pData : PRINT_EXECUTION_DATA* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('winspool.drv');
const GetPrintExecutionData = lib.func('__stdcall', 'GetPrintExecutionData', 'int32_t', ['void *']);
// GetPrintExecutionData(pData)
// pData : PRINT_EXECUTION_DATA* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("winspool.drv", {
GetPrintExecutionData: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.GetPrintExecutionData(pData)
// pData : PRINT_EXECUTION_DATA* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GetPrintExecutionData(
void* pData);
C, "winspool.drv");
// $ffi->GetPrintExecutionData(pData);
// pData : PRINT_EXECUTION_DATA* out
// 構造体/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);
boolean GetPrintExecutionData(
Pointer pData // PRINT_EXECUTION_DATA* out
);
}@[Link("winspool.drv")]
lib Libwinspool.drv
fun GetPrintExecutionData = GetPrintExecutionData(
pData : PRINT_EXECUTION_DATA* # PRINT_EXECUTION_DATA* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GetPrintExecutionDataNative = Int32 Function(Pointer<Void>);
typedef GetPrintExecutionDataDart = int Function(Pointer<Void>);
final GetPrintExecutionData = DynamicLibrary.open('winspool.drv')
.lookupFunction<GetPrintExecutionDataNative, GetPrintExecutionDataDart>('GetPrintExecutionData');
// pData : PRINT_EXECUTION_DATA* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GetPrintExecutionData(
pData: Pointer // PRINT_EXECUTION_DATA* out
): BOOL; stdcall;
external 'winspool.drv' name 'GetPrintExecutionData';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GetPrintExecutionData"
c_GetPrintExecutionData :: Ptr () -> IO CInt
-- pData : PRINT_EXECUTION_DATA* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let getprintexecutiondata =
foreign "GetPrintExecutionData"
((ptr void) @-> returning int32_t)
(* pData : PRINT_EXECUTION_DATA* out -> (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 ("GetPrintExecutionData" get-print-execution-data :convention :stdcall) :int32
(p-data :pointer)) ; PRINT_EXECUTION_DATA* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GetPrintExecutionData = Win32::API::More->new('winspool.drv',
'BOOL GetPrintExecutionData(LPVOID pData)');
# my $ret = $GetPrintExecutionData->Call($pData);
# pData : PRINT_EXECUTION_DATA* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。