ホーム › Graphics.Printing › PRINTER_INFO_5A
PRINTER_INFO_5A
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| pPrinterName | LPSTR | 8/4 | +0 | +0 | プリンタ名(ANSI)へのポインタ。 |
| pPortName | LPSTR | 8/4 | +8 | +4 | 出力先ポート名(ANSI)。複数ポートはカンマ区切り。 |
| Attributes | DWORD | 4 | +16 | +8 | プリンタ属性を示すビットフラグ(PRINTER_ATTRIBUTE_*)。 |
| DeviceNotSelectedTimeout | DWORD | 4 | +20 | +12 | デバイス未選択時のタイムアウト(ミリ秒)。 |
| TransmissionRetryTimeout | DWORD | 4 | +24 | +16 | 送信再試行のタイムアウト(ミリ秒)。 |
各言語での定義
#include <windows.h>
// PRINTER_INFO_5A (x64 32 / x86 20 バイト)
typedef struct PRINTER_INFO_5A {
LPSTR pPrinterName;
LPSTR pPortName;
DWORD Attributes;
DWORD DeviceNotSelectedTimeout;
DWORD TransmissionRetryTimeout;
} PRINTER_INFO_5A;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PRINTER_INFO_5A
{
public IntPtr pPrinterName;
public IntPtr pPortName;
public uint Attributes;
public uint DeviceNotSelectedTimeout;
public uint TransmissionRetryTimeout;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PRINTER_INFO_5A
Public pPrinterName As IntPtr
Public pPortName As IntPtr
Public Attributes As UInteger
Public DeviceNotSelectedTimeout As UInteger
Public TransmissionRetryTimeout As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PRINTER_INFO_5A(ctypes.Structure):
_fields_ = [
("pPrinterName", ctypes.c_void_p),
("pPortName", ctypes.c_void_p),
("Attributes", wintypes.DWORD),
("DeviceNotSelectedTimeout", wintypes.DWORD),
("TransmissionRetryTimeout", wintypes.DWORD),
]#[repr(C)]
pub struct PRINTER_INFO_5A {
pub pPrinterName: *mut core::ffi::c_void,
pub pPortName: *mut core::ffi::c_void,
pub Attributes: u32,
pub DeviceNotSelectedTimeout: u32,
pub TransmissionRetryTimeout: u32,
}import "golang.org/x/sys/windows"
type PRINTER_INFO_5A struct {
pPrinterName uintptr
pPortName uintptr
Attributes uint32
DeviceNotSelectedTimeout uint32
TransmissionRetryTimeout uint32
}type
PRINTER_INFO_5A = record
pPrinterName: Pointer;
pPortName: Pointer;
Attributes: DWORD;
DeviceNotSelectedTimeout: DWORD;
TransmissionRetryTimeout: DWORD;
end;const PRINTER_INFO_5A = extern struct {
pPrinterName: ?*anyopaque,
pPortName: ?*anyopaque,
Attributes: u32,
DeviceNotSelectedTimeout: u32,
TransmissionRetryTimeout: u32,
};type
PRINTER_INFO_5A {.bycopy.} = object
pPrinterName: pointer
pPortName: pointer
Attributes: uint32
DeviceNotSelectedTimeout: uint32
TransmissionRetryTimeout: uint32struct PRINTER_INFO_5A
{
void* pPrinterName;
void* pPortName;
uint Attributes;
uint DeviceNotSelectedTimeout;
uint TransmissionRetryTimeout;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; PRINTER_INFO_5A サイズ: 20 バイト(x86)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; pPrinterName : LPSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pPortName : LPSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Attributes : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; DeviceNotSelectedTimeout : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; TransmissionRetryTimeout : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PRINTER_INFO_5A サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; pPrinterName : LPSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; pPortName : LPSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Attributes : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; DeviceNotSelectedTimeout : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; TransmissionRetryTimeout : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PRINTER_INFO_5A
#field intptr pPrinterName
#field intptr pPortName
#field int Attributes
#field int DeviceNotSelectedTimeout
#field int TransmissionRetryTimeout
#endstruct
stdim st, PRINTER_INFO_5A ; NSTRUCT 変数を確保
st->Attributes = 100
mes "Attributes=" + st->Attributes