ホーム › Graphics.Printing › PRINTER_INFO_2W
PRINTER_INFO_2W
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| pServerName | LPWSTR | 8/4 | +0 | +0 | プリンタを共有するサーバー名(Unicode)。ローカルプリンタではNULL。 |
| pPrinterName | LPWSTR | 8/4 | +8 | +4 | プリンタ名(Unicode)へのポインタ。 |
| pShareName | LPWSTR | 8/4 | +16 | +8 | 共有名(Unicode)へのポインタ。共有していない場合は無効。 |
| pPortName | LPWSTR | 8/4 | +24 | +12 | 出力先ポート名(Unicode)。複数ポートはカンマ区切り。 |
| pDriverName | LPWSTR | 8/4 | +32 | +16 | プリンタドライバ名(Unicode)へのポインタ。 |
| pComment | LPWSTR | 8/4 | +40 | +20 | プリンタのコメント文字列(Unicode)へのポインタ。 |
| pLocation | LPWSTR | 8/4 | +48 | +24 | プリンタの設置場所文字列(Unicode)へのポインタ。 |
| pDevMode | DEVMODEW* | 8/4 | +56 | +28 | 既定のプリンタ設定を示すDEVMODEW構造体へのポインタ。 |
| pSepFile | LPWSTR | 8/4 | +64 | +32 | ジョブ区切りページのファイルパス(Unicode)へのポインタ。 |
| pPrintProcessor | LPWSTR | 8/4 | +72 | +36 | 使用する印刷プロセッサ名(Unicode)へのポインタ。 |
| pDatatype | LPWSTR | 8/4 | +80 | +40 | 印刷データ型(RAW/EMF等)(Unicode)へのポインタ。 |
| pParameters | LPWSTR | 8/4 | +88 | +44 | 印刷プロセッサへ渡す既定パラメータ(Unicode)へのポインタ。 |
| pSecurityDescriptor | PSECURITY_DESCRIPTOR | 8/4 | +96 | +48 | プリンタのセキュリティ記述子へのポインタ。NULL可。 |
| Attributes | DWORD | 4 | +104 | +52 | プリンタ属性を示すビットフラグ(PRINTER_ATTRIBUTE_*)。 |
| Priority | DWORD | 4 | +108 | +56 | 印刷ジョブの既定優先度(1~99)。 |
| DefaultPriority | DWORD | 4 | +112 | +60 | ジョブに割り当てる既定優先度。 |
| StartTime | DWORD | 4 | +116 | +64 | 印刷可能開始時刻(UTC基準の分単位)。 |
| UntilTime | DWORD | 4 | +120 | +68 | 印刷可能終了時刻(UTC基準の分単位)。 |
| Status | DWORD | 4 | +124 | +72 | プリンタの現在状態を示すビットフラグ(PRINTER_STATUS_*)。 |
| cJobs | DWORD | 4 | +128 | +76 | キューに溜まっている印刷ジョブ数。 |
| AveragePPM | DWORD | 4 | +132 | +80 | プリンタの平均印刷速度(1分あたりページ数)。 |
各言語での定義
#include <windows.h>
// PRINTER_INFO_2W (x64 136 / x86 84 バイト)
typedef struct PRINTER_INFO_2W {
LPWSTR pServerName;
LPWSTR pPrinterName;
LPWSTR pShareName;
LPWSTR pPortName;
LPWSTR pDriverName;
LPWSTR pComment;
LPWSTR pLocation;
DEVMODEW* pDevMode;
LPWSTR pSepFile;
LPWSTR pPrintProcessor;
LPWSTR pDatatype;
LPWSTR pParameters;
PSECURITY_DESCRIPTOR pSecurityDescriptor;
DWORD Attributes;
DWORD Priority;
DWORD DefaultPriority;
DWORD StartTime;
DWORD UntilTime;
DWORD Status;
DWORD cJobs;
DWORD AveragePPM;
} PRINTER_INFO_2W;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PRINTER_INFO_2W
{
public IntPtr pServerName;
public IntPtr pPrinterName;
public IntPtr pShareName;
public IntPtr pPortName;
public IntPtr pDriverName;
public IntPtr pComment;
public IntPtr pLocation;
public IntPtr pDevMode;
public IntPtr pSepFile;
public IntPtr pPrintProcessor;
public IntPtr pDatatype;
public IntPtr pParameters;
public IntPtr pSecurityDescriptor;
public uint Attributes;
public uint Priority;
public uint DefaultPriority;
public uint StartTime;
public uint UntilTime;
public uint Status;
public uint cJobs;
public uint AveragePPM;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PRINTER_INFO_2W
Public pServerName As IntPtr
Public pPrinterName As IntPtr
Public pShareName As IntPtr
Public pPortName As IntPtr
Public pDriverName As IntPtr
Public pComment As IntPtr
Public pLocation As IntPtr
Public pDevMode As IntPtr
Public pSepFile As IntPtr
Public pPrintProcessor As IntPtr
Public pDatatype As IntPtr
Public pParameters As IntPtr
Public pSecurityDescriptor As IntPtr
Public Attributes As UInteger
Public Priority As UInteger
Public DefaultPriority As UInteger
Public StartTime As UInteger
Public UntilTime As UInteger
Public Status As UInteger
Public cJobs As UInteger
Public AveragePPM As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PRINTER_INFO_2W(ctypes.Structure):
_fields_ = [
("pServerName", ctypes.c_void_p),
("pPrinterName", ctypes.c_void_p),
("pShareName", ctypes.c_void_p),
("pPortName", ctypes.c_void_p),
("pDriverName", ctypes.c_void_p),
("pComment", ctypes.c_void_p),
("pLocation", ctypes.c_void_p),
("pDevMode", ctypes.c_void_p),
("pSepFile", ctypes.c_void_p),
("pPrintProcessor", ctypes.c_void_p),
("pDatatype", ctypes.c_void_p),
("pParameters", ctypes.c_void_p),
("pSecurityDescriptor", ctypes.c_void_p),
("Attributes", wintypes.DWORD),
("Priority", wintypes.DWORD),
("DefaultPriority", wintypes.DWORD),
("StartTime", wintypes.DWORD),
("UntilTime", wintypes.DWORD),
("Status", wintypes.DWORD),
("cJobs", wintypes.DWORD),
("AveragePPM", wintypes.DWORD),
]#[repr(C)]
pub struct PRINTER_INFO_2W {
pub pServerName: *mut core::ffi::c_void,
pub pPrinterName: *mut core::ffi::c_void,
pub pShareName: *mut core::ffi::c_void,
pub pPortName: *mut core::ffi::c_void,
pub pDriverName: *mut core::ffi::c_void,
pub pComment: *mut core::ffi::c_void,
pub pLocation: *mut core::ffi::c_void,
pub pDevMode: *mut core::ffi::c_void,
pub pSepFile: *mut core::ffi::c_void,
pub pPrintProcessor: *mut core::ffi::c_void,
pub pDatatype: *mut core::ffi::c_void,
pub pParameters: *mut core::ffi::c_void,
pub pSecurityDescriptor: *mut core::ffi::c_void,
pub Attributes: u32,
pub Priority: u32,
pub DefaultPriority: u32,
pub StartTime: u32,
pub UntilTime: u32,
pub Status: u32,
pub cJobs: u32,
pub AveragePPM: u32,
}import "golang.org/x/sys/windows"
type PRINTER_INFO_2W struct {
pServerName uintptr
pPrinterName uintptr
pShareName uintptr
pPortName uintptr
pDriverName uintptr
pComment uintptr
pLocation uintptr
pDevMode uintptr
pSepFile uintptr
pPrintProcessor uintptr
pDatatype uintptr
pParameters uintptr
pSecurityDescriptor uintptr
Attributes uint32
Priority uint32
DefaultPriority uint32
StartTime uint32
UntilTime uint32
Status uint32
cJobs uint32
AveragePPM uint32
}type
PRINTER_INFO_2W = record
pServerName: Pointer;
pPrinterName: Pointer;
pShareName: Pointer;
pPortName: Pointer;
pDriverName: Pointer;
pComment: Pointer;
pLocation: Pointer;
pDevMode: Pointer;
pSepFile: Pointer;
pPrintProcessor: Pointer;
pDatatype: Pointer;
pParameters: Pointer;
pSecurityDescriptor: Pointer;
Attributes: DWORD;
Priority: DWORD;
DefaultPriority: DWORD;
StartTime: DWORD;
UntilTime: DWORD;
Status: DWORD;
cJobs: DWORD;
AveragePPM: DWORD;
end;const PRINTER_INFO_2W = extern struct {
pServerName: ?*anyopaque,
pPrinterName: ?*anyopaque,
pShareName: ?*anyopaque,
pPortName: ?*anyopaque,
pDriverName: ?*anyopaque,
pComment: ?*anyopaque,
pLocation: ?*anyopaque,
pDevMode: ?*anyopaque,
pSepFile: ?*anyopaque,
pPrintProcessor: ?*anyopaque,
pDatatype: ?*anyopaque,
pParameters: ?*anyopaque,
pSecurityDescriptor: ?*anyopaque,
Attributes: u32,
Priority: u32,
DefaultPriority: u32,
StartTime: u32,
UntilTime: u32,
Status: u32,
cJobs: u32,
AveragePPM: u32,
};type
PRINTER_INFO_2W {.bycopy.} = object
pServerName: pointer
pPrinterName: pointer
pShareName: pointer
pPortName: pointer
pDriverName: pointer
pComment: pointer
pLocation: pointer
pDevMode: pointer
pSepFile: pointer
pPrintProcessor: pointer
pDatatype: pointer
pParameters: pointer
pSecurityDescriptor: pointer
Attributes: uint32
Priority: uint32
DefaultPriority: uint32
StartTime: uint32
UntilTime: uint32
Status: uint32
cJobs: uint32
AveragePPM: uint32struct PRINTER_INFO_2W
{
void* pServerName;
void* pPrinterName;
void* pShareName;
void* pPortName;
void* pDriverName;
void* pComment;
void* pLocation;
void* pDevMode;
void* pSepFile;
void* pPrintProcessor;
void* pDatatype;
void* pParameters;
void* pSecurityDescriptor;
uint Attributes;
uint Priority;
uint DefaultPriority;
uint StartTime;
uint UntilTime;
uint Status;
uint cJobs;
uint AveragePPM;
}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_2W サイズ: 84 バイト(x86)
dim st, 21 ; 4byte整数×21(構造体サイズ 84 / 4 切り上げ)
; pServerName : LPWSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pPrinterName : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pShareName : LPWSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; pPortName : LPWSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; pDriverName : LPWSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; pComment : LPWSTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; pLocation : LPWSTR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; pDevMode : DEVMODEW* (+28, 4byte) varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; pSepFile : LPWSTR (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; pPrintProcessor : LPWSTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; pDatatype : LPWSTR (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; pParameters : LPWSTR (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; pSecurityDescriptor : PSECURITY_DESCRIPTOR (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; Attributes : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; Priority : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; DefaultPriority : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; StartTime : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; UntilTime : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; Status : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; cJobs : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; AveragePPM : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PRINTER_INFO_2W サイズ: 136 バイト(x64)
dim st, 34 ; 4byte整数×34(構造体サイズ 136 / 4 切り上げ)
; pServerName : LPWSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; pPrinterName : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pShareName : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; pPortName : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pDriverName : LPWSTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; pComment : LPWSTR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; pLocation : LPWSTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; pDevMode : DEVMODEW* (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; pSepFile : LPWSTR (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; pPrintProcessor : LPWSTR (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; pDatatype : LPWSTR (+80, 8byte) qpoke st,80,値 / qpeek(st,80) ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; pParameters : LPWSTR (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; pSecurityDescriptor : PSECURITY_DESCRIPTOR (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; Attributes : DWORD (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; Priority : DWORD (+108, 4byte) st.27 = 値 / 値 = st.27 (lpoke/lpeek も可)
; DefaultPriority : DWORD (+112, 4byte) st.28 = 値 / 値 = st.28 (lpoke/lpeek も可)
; StartTime : DWORD (+116, 4byte) st.29 = 値 / 値 = st.29 (lpoke/lpeek も可)
; UntilTime : DWORD (+120, 4byte) st.30 = 値 / 値 = st.30 (lpoke/lpeek も可)
; Status : DWORD (+124, 4byte) st.31 = 値 / 値 = st.31 (lpoke/lpeek も可)
; cJobs : DWORD (+128, 4byte) st.32 = 値 / 値 = st.32 (lpoke/lpeek も可)
; AveragePPM : DWORD (+132, 4byte) st.33 = 値 / 値 = st.33 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PRINTER_INFO_2W
#field intptr pServerName
#field intptr pPrinterName
#field intptr pShareName
#field intptr pPortName
#field intptr pDriverName
#field intptr pComment
#field intptr pLocation
#field intptr pDevMode
#field intptr pSepFile
#field intptr pPrintProcessor
#field intptr pDatatype
#field intptr pParameters
#field intptr pSecurityDescriptor
#field int Attributes
#field int Priority
#field int DefaultPriority
#field int StartTime
#field int UntilTime
#field int Status
#field int cJobs
#field int AveragePPM
#endstruct
stdim st, PRINTER_INFO_2W ; NSTRUCT 変数を確保
st->Attributes = 100
mes "Attributes=" + st->Attributes