Win32 API 日本語リファレンス
ホームGraphics.Printing › JOB_INFO_1W

JOB_INFO_1W

構造体
サイズx64: 96 バイト / x86: 64 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
JobIdDWORD4+0+0印刷ジョブを識別する一意のID。
pPrinterNameLPWSTR8/4+8+4ジョブを処理するプリンタ名(Unicode)へのポインタ。
pMachineNameLPWSTR8/4+16+8ジョブを作成したマシン名(Unicode)へのポインタ。
pUserNameLPWSTR8/4+24+12ジョブを送信したユーザー名(Unicode)へのポインタ。
pDocumentLPWSTR8/4+32+16印刷ドキュメント名(Unicode)へのポインタ。
pDatatypeLPWSTR8/4+40+20印刷データ型(RAW/EMF等)(Unicode)へのポインタ。
pStatusLPWSTR8/4+48+24ジョブ状態を表す文字列(Unicode)へのポインタ。NULL可。
StatusDWORD4+56+28ジョブの状態を示すビットフラグ(JOB_STATUS_*)。
PriorityDWORD4+60+32ジョブの優先度(1~99)。
PositionDWORD4+64+36キュー内のジョブ位置。
TotalPagesDWORD4+68+40ドキュメントの総ページ数。
PagesPrintedDWORD4+72+44現在までに印刷されたページ数。
SubmittedSYSTEMTIME16+76+48ジョブが投入された日時を示すSYSTEMTIME。

各言語での定義

#include <windows.h>

// SYSTEMTIME  (x64 16 / x86 16 バイト)
typedef struct SYSTEMTIME {
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} SYSTEMTIME;

// JOB_INFO_1W  (x64 96 / x86 64 バイト)
typedef struct JOB_INFO_1W {
    DWORD JobId;
    LPWSTR pPrinterName;
    LPWSTR pMachineName;
    LPWSTR pUserName;
    LPWSTR pDocument;
    LPWSTR pDatatype;
    LPWSTR pStatus;
    DWORD Status;
    DWORD Priority;
    DWORD Position;
    DWORD TotalPages;
    DWORD PagesPrinted;
    SYSTEMTIME Submitted;
} JOB_INFO_1W;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SYSTEMTIME
{
    public ushort wYear;
    public ushort wMonth;
    public ushort wDayOfWeek;
    public ushort wDay;
    public ushort wHour;
    public ushort wMinute;
    public ushort wSecond;
    public ushort wMilliseconds;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct JOB_INFO_1W
{
    public uint JobId;
    public IntPtr pPrinterName;
    public IntPtr pMachineName;
    public IntPtr pUserName;
    public IntPtr pDocument;
    public IntPtr pDatatype;
    public IntPtr pStatus;
    public uint Status;
    public uint Priority;
    public uint Position;
    public uint TotalPages;
    public uint PagesPrinted;
    public SYSTEMTIME Submitted;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SYSTEMTIME
    Public wYear As UShort
    Public wMonth As UShort
    Public wDayOfWeek As UShort
    Public wDay As UShort
    Public wHour As UShort
    Public wMinute As UShort
    Public wSecond As UShort
    Public wMilliseconds As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure JOB_INFO_1W
    Public JobId As UInteger
    Public pPrinterName As IntPtr
    Public pMachineName As IntPtr
    Public pUserName As IntPtr
    Public pDocument As IntPtr
    Public pDatatype As IntPtr
    Public pStatus As IntPtr
    Public Status As UInteger
    Public Priority As UInteger
    Public Position As UInteger
    Public TotalPages As UInteger
    Public PagesPrinted As UInteger
    Public Submitted As SYSTEMTIME
End Structure
import ctypes
from ctypes import wintypes

class SYSTEMTIME(ctypes.Structure):
    _fields_ = [
        ("wYear", ctypes.c_ushort),
        ("wMonth", ctypes.c_ushort),
        ("wDayOfWeek", ctypes.c_ushort),
        ("wDay", ctypes.c_ushort),
        ("wHour", ctypes.c_ushort),
        ("wMinute", ctypes.c_ushort),
        ("wSecond", ctypes.c_ushort),
        ("wMilliseconds", ctypes.c_ushort),
    ]

class JOB_INFO_1W(ctypes.Structure):
    _fields_ = [
        ("JobId", wintypes.DWORD),
        ("pPrinterName", ctypes.c_void_p),
        ("pMachineName", ctypes.c_void_p),
        ("pUserName", ctypes.c_void_p),
        ("pDocument", ctypes.c_void_p),
        ("pDatatype", ctypes.c_void_p),
        ("pStatus", ctypes.c_void_p),
        ("Status", wintypes.DWORD),
        ("Priority", wintypes.DWORD),
        ("Position", wintypes.DWORD),
        ("TotalPages", wintypes.DWORD),
        ("PagesPrinted", wintypes.DWORD),
        ("Submitted", SYSTEMTIME),
    ]
#[repr(C)]
pub struct SYSTEMTIME {
    pub wYear: u16,
    pub wMonth: u16,
    pub wDayOfWeek: u16,
    pub wDay: u16,
    pub wHour: u16,
    pub wMinute: u16,
    pub wSecond: u16,
    pub wMilliseconds: u16,
}

#[repr(C)]
pub struct JOB_INFO_1W {
    pub JobId: u32,
    pub pPrinterName: *mut core::ffi::c_void,
    pub pMachineName: *mut core::ffi::c_void,
    pub pUserName: *mut core::ffi::c_void,
    pub pDocument: *mut core::ffi::c_void,
    pub pDatatype: *mut core::ffi::c_void,
    pub pStatus: *mut core::ffi::c_void,
    pub Status: u32,
    pub Priority: u32,
    pub Position: u32,
    pub TotalPages: u32,
    pub PagesPrinted: u32,
    pub Submitted: SYSTEMTIME,
}
import "golang.org/x/sys/windows"

type SYSTEMTIME struct {
	wYear uint16
	wMonth uint16
	wDayOfWeek uint16
	wDay uint16
	wHour uint16
	wMinute uint16
	wSecond uint16
	wMilliseconds uint16
}

type JOB_INFO_1W struct {
	JobId uint32
	pPrinterName uintptr
	pMachineName uintptr
	pUserName uintptr
	pDocument uintptr
	pDatatype uintptr
	pStatus uintptr
	Status uint32
	Priority uint32
	Position uint32
	TotalPages uint32
	PagesPrinted uint32
	Submitted SYSTEMTIME
}
type
  SYSTEMTIME = record
    wYear: Word;
    wMonth: Word;
    wDayOfWeek: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;

  JOB_INFO_1W = record
    JobId: DWORD;
    pPrinterName: Pointer;
    pMachineName: Pointer;
    pUserName: Pointer;
    pDocument: Pointer;
    pDatatype: Pointer;
    pStatus: Pointer;
    Status: DWORD;
    Priority: DWORD;
    Position: DWORD;
    TotalPages: DWORD;
    PagesPrinted: DWORD;
    Submitted: SYSTEMTIME;
  end;
const SYSTEMTIME = extern struct {
    wYear: u16,
    wMonth: u16,
    wDayOfWeek: u16,
    wDay: u16,
    wHour: u16,
    wMinute: u16,
    wSecond: u16,
    wMilliseconds: u16,
};

const JOB_INFO_1W = extern struct {
    JobId: u32,
    pPrinterName: ?*anyopaque,
    pMachineName: ?*anyopaque,
    pUserName: ?*anyopaque,
    pDocument: ?*anyopaque,
    pDatatype: ?*anyopaque,
    pStatus: ?*anyopaque,
    Status: u32,
    Priority: u32,
    Position: u32,
    TotalPages: u32,
    PagesPrinted: u32,
    Submitted: SYSTEMTIME,
};
type
  SYSTEMTIME {.bycopy.} = object
    wYear: uint16
    wMonth: uint16
    wDayOfWeek: uint16
    wDay: uint16
    wHour: uint16
    wMinute: uint16
    wSecond: uint16
    wMilliseconds: uint16

  JOB_INFO_1W {.bycopy.} = object
    JobId: uint32
    pPrinterName: pointer
    pMachineName: pointer
    pUserName: pointer
    pDocument: pointer
    pDatatype: pointer
    pStatus: pointer
    Status: uint32
    Priority: uint32
    Position: uint32
    TotalPages: uint32
    PagesPrinted: uint32
    Submitted: SYSTEMTIME
struct SYSTEMTIME
{
    ushort wYear;
    ushort wMonth;
    ushort wDayOfWeek;
    ushort wDay;
    ushort wHour;
    ushort wMinute;
    ushort wSecond;
    ushort wMilliseconds;
}

struct JOB_INFO_1W
{
    uint JobId;
    void* pPrinterName;
    void* pMachineName;
    void* pUserName;
    void* pDocument;
    void* pDatatype;
    void* pStatus;
    uint Status;
    uint Priority;
    uint Position;
    uint TotalPages;
    uint PagesPrinted;
    SYSTEMTIME Submitted;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; JOB_INFO_1W サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; JobId : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pPrinterName : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; pMachineName : LPWSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; pUserName : LPWSTR (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pDocument : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; pDatatype : LPWSTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; pStatus : LPWSTR (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; Status : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; Priority : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; Position : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; TotalPages : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; PagesPrinted : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; Submitted : SYSTEMTIME (+48, 16byte)  varptr(st)+48 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; JOB_INFO_1W サイズ: 96 バイト(x64)
dim st, 24    ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; JobId : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pPrinterName : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pMachineName : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; pUserName : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pDocument : LPWSTR (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; pDatatype : LPWSTR (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; pStatus : LPWSTR (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; Status : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; Priority : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; Position : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; TotalPages : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; PagesPrinted : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; Submitted : SYSTEMTIME (+76, 16byte)  varptr(st)+76 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SYSTEMTIME
    #field short wYear
    #field short wMonth
    #field short wDayOfWeek
    #field short wDay
    #field short wHour
    #field short wMinute
    #field short wSecond
    #field short wMilliseconds
#endstruct

#defstruct global JOB_INFO_1W
    #field int JobId
    #field intptr pPrinterName
    #field intptr pMachineName
    #field intptr pUserName
    #field intptr pDocument
    #field intptr pDatatype
    #field intptr pStatus
    #field int Status
    #field int Priority
    #field int Position
    #field int TotalPages
    #field int PagesPrinted
    #field SYSTEMTIME Submitted
#endstruct

stdim st, JOB_INFO_1W        ; NSTRUCT 変数を確保
st->JobId = 100
mes "JobId=" + st->JobId